Browse Source

Allow user defined options for the backend servers

There are many possible options that can be set for haproxy backend
servers but the current template does not provide a means for these
to be supplied. This patch follows the pattern already used with
haproxy_backend_options and creates a new haproxy_backend_server_options.

Change-Id: Ic312e5915a5df07121ffadca643ca6e4013e00ee
Jonathan Rosser 4 months ago
parent
commit
4a22e7683b
2 changed files with 10 additions and 0 deletions
  1. 2
    0
      defaults/main.yml
  2. 8
    0
      templates/service.j2

+ 2
- 0
defaults/main.yml View File

@@ -51,6 +51,8 @@ haproxy_service_configs: []
51 51
 #         - "forwardfor"
52 52
 #         - "httpchk"
53 53
 #         - "httplog"
54
+#       haproxy_backend_server_options:
55
+#         - "inter 3000"                # a contrived example, there are many server config options possible
54 56
 #       haproxy_acls:
55 57
 #         white_list:
56 58
 #           rule: "src 127.0.0.1/8 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8"

+ 8
- 0
templates/service.j2 View File

@@ -124,6 +124,10 @@ backend {{ item.service.haproxy_service_name }}-back
124 124
 {% set _ = entry.append("verify none") %}
125 125
 {% endif %}
126 126
 {% endif %}
127
+{% set backend_server_options = item.service.haproxy_backend_server_options|default([]) %}
128
+{% for option in backend_server_options %}
129
+{%  set _ = entry.append(option) %}
130
+{% endfor %}
127 131
     {{ entry | join(' ') }}
128 132
 {% endfor %}
129 133
 
@@ -154,5 +158,9 @@ backend {{ item.service.haproxy_service_name }}-back
154 158
 {% set _ = entry.append("verify none") %}
155 159
 {% endif %}
156 160
 {% endif %}
161
+{% set backend_server_options = item.service.haproxy_backend_server_options|default([]) %}
162
+{% for option in backend_server_options %}
163
+{%  set _ = entry.append(option) %}
164
+{% endfor %}
157 165
     {{ entry | join(' ') }}
158 166
 {% endfor %}

Loading…
Cancel
Save