Skip to content

Commit

Permalink
Merge pull request #70 from yumapos/no_option_in_bcnd_dflt
Browse files Browse the repository at this point in the history
No option in backend and defaults templates
  • Loading branch information
tersmitten authored Oct 22, 2017
2 parents c3e0f42 + fe28338 commit c01f00f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_defaults_mode`: [default: `http`]: Set the running mode or protocol of the instance
* `haproxy_defaults_source`: [optional]: Set the source address or interface for connections from the proxy
* `haproxy_defaults_option`: [default: `[httplog, dontlognull]`]: Options (default)
* `haproxy_defaults_no_option`: [optional]: Options to unset (e.g. `[redispatch]`)
* `haproxy_defaults_timeout`: [default: See `defaults/main.yml`]: Timeout declarations
* `haproxy_defaults_timeout.type`: [required]: The type (e.g. `connect`, `client`, `server`)
* `haproxy_defaults_timeout.timeout`: [required]: The timeout (in in milliseconds by default, but can be in any other unit if the number is suffixed by the unit) (e.g. `5000`, `50000`)
Expand Down Expand Up @@ -191,6 +192,7 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_backend.{n}.balance`: [required]: The load balancing algorithm to be used (e.g. `roundrobin`)
* `haproxy_backend.{n}.source`: [optional]: Set the source address or interface for connections from the proxy
* `haproxy_backend.{n}.option`: [optional]: Options to set (e.g. `[forwardfor]`)
* `haproxy_backend.{n}.no_option`: [optional]: Options to unset (e.g. `[redispatch]`)
* `haproxy_backend.{n}.http_check`: [optional]: Make HTTP health checks consider response contents or specific status codes (e.g. `expect status 403`)
* `haproxy_backend.{n}.stick`: [optional]: Stick declarations
* `haproxy_backend.{n}.stick.{n}.table`: [required]: Configure the stickiness table for the current section (e.g. `type ip size 500k`)
Expand Down
4 changes: 4 additions & 0 deletions templates/etc/haproxy/backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ backend {{ backend.name }}
option {{ option }}
{% endfor %}

{% for option in backend.no_option | default([])%}
no option {{ option }}
{% endfor %}

{% if backend.http_check is defined %}
http-check {{ backend.http_check }}
{% endif %}
Expand Down
6 changes: 6 additions & 0 deletions templates/etc/haproxy/defaults.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
{% endfor %}
{% endif %}

{% if haproxy_defaults_no_option is defined %}
{% for option in haproxy_defaults_no_option %}
no option {{ option }}
{% endfor %}
{% endif %}

{% if haproxy_defaults_timeout != false %}
{% for timeout in haproxy_defaults_timeout %}
timeout {{ timeout.type }} {{ timeout.timeout }}
Expand Down

0 comments on commit c01f00f

Please sign in to comment.