allow custom options using "extra"
This commit is contained in:
parent
e465b79a59
commit
822db0e338
3 changed files with 44 additions and 0 deletions
|
@ -74,6 +74,7 @@ Currently, only a handful of options can be set using the pillar:
|
||||||
+ port: the port to contact the server on
|
+ port: the port to contact the server on
|
||||||
+ check: set to check to enable checking
|
+ check: set to check to enable checking
|
||||||
|
|
||||||
|
- For global, default, frontend, listener, backend and server it is possible to use the "extra" option for more rare settings not mentioned above.
|
||||||
|
|
||||||
``haproxy.service``
|
``haproxy.service``
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -63,6 +63,15 @@ global
|
||||||
{%- if 'ssl-default-bind-options' in salt['pillar.get']('haproxy:global', {}) %}
|
{%- if 'ssl-default-bind-options' in salt['pillar.get']('haproxy:global', {}) %}
|
||||||
{{- render_list_of_dictionaries('ssl-default-bind-options', salt['pillar.get']('haproxy:global:ssl-default-bind-options')) }}
|
{{- render_list_of_dictionaries('ssl-default-bind-options', salt['pillar.get']('haproxy:global:ssl-default-bind-options')) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if 'extra' in salt['pillar.get']('haproxy:global', {}) %}
|
||||||
|
{%- if salt['pillar.get']('haproxy:global:extra', {}) is string %}
|
||||||
|
{{ salt['pillar.get']('haproxy:global:extra') }}
|
||||||
|
{%- else %}
|
||||||
|
{%- for line in salt['pillar.get']('haproxy:global:extra') %}
|
||||||
|
{{ line }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- for id, userlist in salt['pillar.get']('haproxy:userlists', {})|dictsort %}
|
{%- for id, userlist in salt['pillar.get']('haproxy:userlists', {})|dictsort %}
|
||||||
#------------------
|
#------------------
|
||||||
|
@ -125,6 +134,15 @@ defaults
|
||||||
{%- if 'stats' in salt['pillar.get']('haproxy:defaults', {}) -%}
|
{%- if 'stats' in salt['pillar.get']('haproxy:defaults', {}) -%}
|
||||||
{{ render_list_of_dictionaries('stats', salt['pillar.get']('haproxy:defaults:stats')) }}
|
{{ render_list_of_dictionaries('stats', salt['pillar.get']('haproxy:defaults:stats')) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if 'extra' in salt['pillar.get']('haproxy:defaults', {}) %}
|
||||||
|
{%- if salt['pillar.get']('haproxy:defaults:extra', {}) is string %}
|
||||||
|
{{ salt['pillar.get']('haproxy:defaults:extra') }}
|
||||||
|
{%- else %}
|
||||||
|
{%- for line in salt['pillar.get']('haproxy:defaults:extra') %}
|
||||||
|
{{ line }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
{%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %}
|
{%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %}
|
||||||
{%- for errorfile_name, errorfile in salt['pillar.get']('haproxy:defaults:errorfiles')|dictsort %}
|
{%- for errorfile_name, errorfile in salt['pillar.get']('haproxy:defaults:errorfiles')|dictsort %}
|
||||||
errorfile {{ errorfile_name }} {{ errorfile }}
|
errorfile {{ errorfile_name }} {{ errorfile }}
|
||||||
|
@ -316,6 +334,13 @@ listen {{ listener.get('name', listener_name) }}
|
||||||
appsession {%- for option in listener.appsession %} {{ option }} {%- endfor %}
|
appsession {%- for option in listener.appsession %} {{ option }} {%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if 'extra' in listener %}
|
||||||
|
{%- if listener.extra is string %}
|
||||||
|
{{ listener.extra }}
|
||||||
|
{%- else %}
|
||||||
|
{%- for line in listerner.extra %} {{ line }} {%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
{%- if 'defaultserver' in listener %}
|
{%- if 'defaultserver' in listener %}
|
||||||
default-server {%- for option, value in listener.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
|
default-server {%- for option, value in listener.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -402,6 +427,15 @@ frontend {{ frontend.get('name', frontend_name) }}
|
||||||
{%- if 'stickons' in frontend %}
|
{%- if 'stickons' in frontend %}
|
||||||
{{- render_list_of_dictionaries('stickon', frontend.stickons) }}
|
{{- render_list_of_dictionaries('stickon', frontend.stickons) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if 'extra' in frontend %}
|
||||||
|
{%- if frontend.extra is string %}
|
||||||
|
{{ frontend.extra }}
|
||||||
|
{%- else %}
|
||||||
|
{%- for line in frontend.extra %}
|
||||||
|
{{ line }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
{%- if 'default_backend' in frontend %}
|
{%- if 'default_backend' in frontend %}
|
||||||
default_backend {{ frontend.default_backend }}
|
default_backend {{ frontend.default_backend }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -513,6 +547,13 @@ backend {{ backend.get('name', backend_name) }}
|
||||||
{%- if 'reqreps' in backend %}
|
{%- if 'reqreps' in backend %}
|
||||||
{{- render_list_of_dictionaries('reqrep', backend.reqreps) }}
|
{{- render_list_of_dictionaries('reqrep', backend.reqreps) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if 'extra' in backend %}
|
||||||
|
{%- if backend.extra is string %}
|
||||||
|
{{ backend.extra }}
|
||||||
|
{%- else %}
|
||||||
|
{%- for line in backend.extra %} {{ line }} {%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
{%- if 'defaultserver' in backend %}
|
{%- if 'defaultserver' in backend %}
|
||||||
default-server {%- for option, value in backend.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
|
default-server {%- for option, value in backend.defaultserver|dictsort %} {{ ' '.join((option, value|string, '')) }} {%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -127,6 +127,7 @@ haproxy:
|
||||||
- url_static path_end -i .jpg .gif .png .css .js
|
- url_static path_end -i .jpg .gif .png .css .js
|
||||||
use_backends:
|
use_backends:
|
||||||
- static-backend if url_static
|
- static-backend if url_static
|
||||||
|
extra: "rspadd Strict-Transport-Security:\ max-age=15768000"
|
||||||
some-services:
|
some-services:
|
||||||
bind:
|
bind:
|
||||||
- "*:8080"
|
- "*:8080"
|
||||||
|
@ -139,6 +140,7 @@ haproxy:
|
||||||
balance: roundrobin
|
balance: roundrobin
|
||||||
redirects:
|
redirects:
|
||||||
- scheme https if !{ ssl_fc }
|
- scheme https if !{ ssl_fc }
|
||||||
|
extra: "reqidel ^X-Forwarded-For:"
|
||||||
servers:
|
servers:
|
||||||
server1:
|
server1:
|
||||||
name: server1-its-name
|
name: server1-its-name
|
||||||
|
|
Loading…
Reference in a new issue