diff --git a/defaults/main.yml b/defaults/main.yml index 34796ba16bc9484edcdeb1bfc9419b039bc3cf70..2291149c8ba6ededea1f8b899b1aaa16a1afd1e4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,8 @@ proxy_timeout_connect: '5s' proxy_timeout_client: '20s' proxy_timeout_server: '45s' proxy_redirect_aliase: false +proxy_maxconn: 100 +proxy_varnish_maxconn: 1000 proxy_blacklist: ip: - '146.185.176.158' diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index 1974db71a0897d52e41010eb1aba7455c6f86933..46cf9c8ef88446807791e303d5de5d5ae4423a15 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -216,7 +216,7 @@ backend backend_{{host}} {% if host == inventory_hostname or host == 'localhost' %} http-response deny {% else %} - server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn 100 + server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}} {% endif %} backend backend_{{host}}_bigpipe @@ -224,7 +224,7 @@ backend backend_{{host}}_bigpipe http-response deny {% else %} no option http-buffer-request - server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn 100 + server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}} {% endif %} backend backend_{{host}}_https @@ -232,7 +232,7 @@ backend backend_{{host}}_https http-response deny {% else %} http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;" - server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn 100 + server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}} {% endif %} backend backend_{{host}}_https_bigpipe @@ -241,7 +241,7 @@ backend backend_{{host}}_https_bigpipe {% else %} no option http-buffer-request http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;" - server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn 100 + server server_{{host}} {{hostvars[host]['static_ipv4']}}:80 maxconn {{hostvars[host]['proxy_maxconn']|default(proxy_maxconn)}} {% endif %} {% endfor %} {% if varnish_host|default(false) %} @@ -253,9 +253,9 @@ backend backend_varnish option forwardfor hash-type consistent {% if varnish_host == inventory_hostname %} - server varnish 127.0.0.1:6081 maxconn 1000 + server varnish 127.0.0.1:6081 maxconn {{proxy_varnish_maxconn}} {% else %} - server varnish {{ varnish_host_ip|default('') }}:6081 maxconn 1000 + server varnish {{ varnish_host_ip|default('') }}:6081 maxconn {{proxy_varnish_maxconn}} {% endif %} backend backend_varnish_bigpipe @@ -265,9 +265,9 @@ backend backend_varnish_bigpipe option forwardfor hash-type consistent {% if varnish_host == inventory_hostname %} - server varnish 127.0.0.1:6081 maxconn 1000 + server varnish 127.0.0.1:6081 maxconn {{proxy_varnish_maxconn}} {% else %} - server varnish {{ varnish_host_ip|default('') }}:6081 maxconn 1000 + server varnish {{ varnish_host_ip|default('') }}:6081 maxconn {{proxy_varnish_maxconn}} {% endif %} {% endif %}