From 4f38f29dfee1bbd7d424a2f013c0c631eceee18d Mon Sep 17 00:00:00 2001 From: Adam Kowalik Date: Fri, 14 Jun 2024 14:34:36 +0200 Subject: [PATCH 1/2] Adding option to set global toggles. --- defaults/main.yml | 1 + templates/etc/haproxy/haproxy-global.cfg.j2 | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 6b754f0..87006c0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -56,6 +56,7 @@ haproxy_global_logs: haproxy_global_tunes: - tune.ssl.default-dh-param: 2048 # haproxy_global_server_state_base: current +# haproxy_global_toggles: [] # Default haproxy_default_logs: diff --git a/templates/etc/haproxy/haproxy-global.cfg.j2 b/templates/etc/haproxy/haproxy-global.cfg.j2 index bccde8e..5cff4e1 100644 --- a/templates/etc/haproxy/haproxy-global.cfg.j2 +++ b/templates/etc/haproxy/haproxy-global.cfg.j2 @@ -78,4 +78,9 @@ global {% endif %} {% if haproxy_global_server_state_base is defined %} server-state-base {{ haproxy_global_server_state_base }} +{% endif %} +{% if haproxy_global_toggles is defined and haproxy_global_toggles|length %} + {% for toggle in haproxy_global_toggles %} + {{ toggle }} + {% endfor %} {% endif %} \ No newline at end of file From 255b3f51760413eb58634b208f44e7dbea95105f Mon Sep 17 00:00:00 2001 From: Adam Kowalik Date: Fri, 14 Jun 2024 14:34:36 +0200 Subject: [PATCH 2/2] Adding option to set global toggles. --- templates/etc/haproxy/haproxy-global.cfg.j2 | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/templates/etc/haproxy/haproxy-global.cfg.j2 b/templates/etc/haproxy/haproxy-global.cfg.j2 index 5cff4e1..67f930c 100644 --- a/templates/etc/haproxy/haproxy-global.cfg.j2 +++ b/templates/etc/haproxy/haproxy-global.cfg.j2 @@ -2,7 +2,7 @@ # GLOBAL # ########################## global -{% if haproxy_global_chroot is defined and haproxy_global_chroot|length %} +{% if haproxy_global_chroot is defined and haproxy_global_chroot | length %} chroot {{ haproxy_global_chroot | default('/var/lib/haproxy') }} {% endif %} {% if haproxy_global_daemon %} @@ -26,50 +26,50 @@ global {% endif %} maxconn {{ haproxy_global_maxconn | default('4000') }} pidfile {{ haproxy_global_pidfile | default('/var/run/haproxy.pid') }} -{% if haproxy_global_ca_base is defined and haproxy_global_ca_base|length %} +{% if haproxy_global_ca_base is defined and haproxy_global_ca_base | length %} ca-base {{ haproxy_global_ca_base }} {% endif %} -{% if haproxy_global_crt_base is defined and haproxy_global_crt_base|length %} +{% if haproxy_global_crt_base is defined and haproxy_global_crt_base | length %} crt-base {{ haproxy_global_crt_base }} {% endif %} -{% if haproxy_global_ssl_bind_options is defined and haproxy_global_ssl_bind_options|length %} +{% if haproxy_global_ssl_bind_options is defined and haproxy_global_ssl_bind_options | length %} ssl-default-bind-options {{ haproxy_global_ssl_bind_options }} {% endif %} -{% if haproxy_global_ssl_bind_ciphers is defined and haproxy_global_ssl_bind_ciphers|length %} +{% if haproxy_global_ssl_bind_ciphers is defined and haproxy_global_ssl_bind_ciphers | length %} ssl-default-bind-ciphers {{ haproxy_global_ssl_bind_ciphers }} {% endif %} -{% if haproxy_global_ssl_bind_ciphersuites is defined and haproxy_global_ssl_bind_ciphersuites|length %} +{% if haproxy_global_ssl_bind_ciphersuites is defined and haproxy_global_ssl_bind_ciphersuites | length %} ssl-default-bind-ciphersuites {{ haproxy_global_ssl_bind_ciphersuites }} {% endif %} -{% if haproxy_global_ssl_server_options is defined and haproxy_global_ssl_server_options|length %} +{% if haproxy_global_ssl_server_options is defined and haproxy_global_ssl_server_options | length %} ssl-default-server-options {{ haproxy_global_ssl_server_options }} {% endif %} -{% if haproxy_global_ssl_server_ciphers is defined and haproxy_global_ssl_server_ciphers|length %} +{% if haproxy_global_ssl_server_ciphers is defined and haproxy_global_ssl_server_ciphers | length %} ssl-default-server-ciphers {{ haproxy_global_ssl_server_ciphers }} {% endif %} -{% if haproxy_global_ssl_server_ciphersuites is defined and haproxy_global_ssl_server_ciphersuites|length %} +{% if haproxy_global_ssl_server_ciphersuites is defined and haproxy_global_ssl_server_ciphersuites | length %} ssl-default-server-ciphersuites {{ haproxy_global_ssl_server_ciphersuites }} {% endif %} -{% if haproxy_global_ssl_server_verify is defined and haproxy_global_ssl_server_verify|length %} +{% if haproxy_global_ssl_server_verify is defined and haproxy_global_ssl_server_verify | length %} ssl-server-verify {{ haproxy_global_ssl_server_verify }} {% endif %} -{% if haproxy_global_stats is defined and haproxy_global_stats|length %} +{% if haproxy_global_stats is defined and haproxy_global_stats | length %} {% for stat in haproxy_global_stats %} stats {{ stat }} {% endfor %} {% endif %} -{% if haproxy_global_description is defined and haproxy_global_description|length %} +{% if haproxy_global_description is defined and haproxy_global_description | length %} description {{ haproxy_global_description }} {% endif %} {% if haproxy_global_ulimit_n is defined and haproxy_global_ulimit_n > 0 %} ulimit-n {{ haproxy_global_ulimit_n }} {% endif %} -{% if haproxy_global_logs is defined and haproxy_global_logs|length %} +{% if haproxy_global_logs is defined and haproxy_global_logs | length %} {% for log in haproxy_global_logs %} log {{ log }} {% endfor %} {% endif %} -{% if haproxy_global_tunes is defined and haproxy_global_tunes|length %} +{% if haproxy_global_tunes is defined and haproxy_global_tunes | length %} {% for tune in haproxy_global_tunes %} {% for key, value in tune.items() %} {{ key }} {{ value }} @@ -79,8 +79,8 @@ global {% if haproxy_global_server_state_base is defined %} server-state-base {{ haproxy_global_server_state_base }} {% endif %} -{% if haproxy_global_toggles is defined and haproxy_global_toggles|length %} +{% if haproxy_global_toggles is defined and haproxy_global_toggles | length %} {% for toggle in haproxy_global_toggles %} {{ toggle }} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %}