diff --git a/defaults/main.yml b/defaults/main.yml index 81f2517..8d91872 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,6 +33,9 @@ haproxy_stats_port: 1936 haproxy_username: admin haproxy_stats_password: secrete haproxy_stats_refresh_interval: 60 +# Pin stats gathering to one or more processes when using 'nbproc' tuning +# For permitted options see https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#3.1-stats%20bind-process +# haproxy_stats_process: all # Default haproxy backup nodes to empty list so this doesn't have to be # defined for each service. diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index 5e544e4..2dd4335 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -18,6 +18,9 @@ global tune.ssl.lifetime {{ haproxy_tuning_params.ssl_lifetime | default('300') }} {% endif %} stats socket /var/run/haproxy.stat level admin mode 600 +{% if haproxy_stats_process is defined %} + stats bind-process {{ haproxy_stats_process }} +{% endif %} {% if haproxy_ssl | bool %} ssl-default-bind-options {{ haproxy_ssl_bind_options }} tune.ssl.default-dh-param {{haproxy_ssl_dh_param}} @@ -39,6 +42,9 @@ defaults listen stats bind {{ haproxy_stats_bind_address }}:{{ haproxy_stats_port }} {% if haproxy_ssl | bool %}ssl crt {{ haproxy_ssl_pem }} ciphers {{ haproxy_ssl_cipher_suite }}{% endif %} +{% if haproxy_stats_process is defined %} + bind-process {{ haproxy_stats_process }} +{% endif %} mode http stats enable stats hide-version