From 2a66893447ca6526a61505f338b26783c8ed8173 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 10 May 2024 14:18:56 +0200 Subject: [PATCH 1/3] feat: add server-state options --- defaults/main.yml | 2 ++ templates/etc/haproxy/haproxy-default.cfg.j2 | 3 +++ templates/etc/haproxy/haproxy-global.cfg.j2 | 3 +++ 3 files changed, 8 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 4825409..6b754f0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -55,6 +55,7 @@ haproxy_global_logs: # - 2 1 haproxy_global_tunes: - tune.ssl.default-dh-param: 2048 +# haproxy_global_server_state_base: current # Default haproxy_default_logs: @@ -83,6 +84,7 @@ haproxy_default_errorfiles: # haproxy_default_http_check: # haproxy_default_monitor_uri: # haproxy_default_unique_id_format: +# haproxy_default_load_server_state_from_file: global # Stats haproxy_stats: true diff --git a/templates/etc/haproxy/haproxy-default.cfg.j2 b/templates/etc/haproxy/haproxy-default.cfg.j2 index cb9cfca..baf769c 100644 --- a/templates/etc/haproxy/haproxy-default.cfg.j2 +++ b/templates/etc/haproxy/haproxy-default.cfg.j2 @@ -45,3 +45,6 @@ defaults {% if haproxy_default_unique_id_format is defined and haproxy_default_unique_id_format | length %} unique-id-format {{ haproxy_default_unique_id_format }} {% endif %} +{% if haproxy_default_load_server_state_from_file is defined and haproxy_default_load_server_state_from_file|length %} + load-server-state-from-file {{ haproxy_default_load_server_state_from_file | default('global') }} +{% endif %} \ No newline at end of file diff --git a/templates/etc/haproxy/haproxy-global.cfg.j2 b/templates/etc/haproxy/haproxy-global.cfg.j2 index dc2e39e..8655ea9 100644 --- a/templates/etc/haproxy/haproxy-global.cfg.j2 +++ b/templates/etc/haproxy/haproxy-global.cfg.j2 @@ -76,3 +76,6 @@ global {% endfor %} {% endfor %} {% endif %} +{% if haproxy_global_server_state_base is defined %} + server-state-base {{ haproxy_global_server_state_base | default('current') }} +{% endif %} \ No newline at end of file From 000fd64e6737b8f88483fd3651b511cae0e021b0 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 10 May 2024 14:19:44 +0200 Subject: [PATCH 2/3] feat: add maxconn for frontend --- templates/etc/haproxy/haproxy-frontend.cfg.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/etc/haproxy/haproxy-frontend.cfg.j2 b/templates/etc/haproxy/haproxy-frontend.cfg.j2 index acc2e77..7d900cf 100644 --- a/templates/etc/haproxy/haproxy-frontend.cfg.j2 +++ b/templates/etc/haproxy/haproxy-frontend.cfg.j2 @@ -120,6 +120,9 @@ frontend {{ name }} {% endif %} {% if value.default_backend is defined %} default_backend {{ value.default_backend }} + {% endif %} + {% if value.maxconn is defined %} + maxconn {{ value.maxconn }} {% endif %} {% if value.unique_id_format is defined %} unique-id-format {{ value.unique_id_format }} From 7b206d0f5d53b6f51316c7e14124d92ac666de14 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 10 May 2024 15:03:36 +0200 Subject: [PATCH 3/3] fix: remove default values duplication --- templates/etc/haproxy/haproxy-default.cfg.j2 | 2 +- templates/etc/haproxy/haproxy-global.cfg.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/etc/haproxy/haproxy-default.cfg.j2 b/templates/etc/haproxy/haproxy-default.cfg.j2 index baf769c..e132558 100644 --- a/templates/etc/haproxy/haproxy-default.cfg.j2 +++ b/templates/etc/haproxy/haproxy-default.cfg.j2 @@ -46,5 +46,5 @@ defaults unique-id-format {{ haproxy_default_unique_id_format }} {% endif %} {% if haproxy_default_load_server_state_from_file is defined and haproxy_default_load_server_state_from_file|length %} - load-server-state-from-file {{ haproxy_default_load_server_state_from_file | default('global') }} + load-server-state-from-file {{ haproxy_default_load_server_state_from_file }} {% endif %} \ No newline at end of file diff --git a/templates/etc/haproxy/haproxy-global.cfg.j2 b/templates/etc/haproxy/haproxy-global.cfg.j2 index 8655ea9..bccde8e 100644 --- a/templates/etc/haproxy/haproxy-global.cfg.j2 +++ b/templates/etc/haproxy/haproxy-global.cfg.j2 @@ -77,5 +77,5 @@ global {% endfor %} {% endif %} {% if haproxy_global_server_state_base is defined %} - server-state-base {{ haproxy_global_server_state_base | default('current') }} + server-state-base {{ haproxy_global_server_state_base }} {% endif %} \ No newline at end of file