Replace hard coded timeout values with variables

Currently the timeout values for client/connect/server are hard coded
in templates/haproxy.cfg.j2. In order to give users flexibility to
override these values, for example increase timeout or reduce timeout,
I replaced hard coded timeout values with variables.

The original default values are still kept in defaults/main.yml.

Closes-Bug: #1696703

Change-Id: I72e9691a074df04e9fb7c4ddc0fe610c8d13feff
This commit is contained in:
Chenjun Shen 2017-06-08 12:50:09 +02:00
parent 0f7a6d4885
commit 88ec33a6c0
2 changed files with 15 additions and 5 deletions

View File

@ -75,8 +75,18 @@ haproxy_ssl_bind_options: "no-sslv3"
haproxy_hatop_download_url: "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/hatop/hatop-0.7.7.tar.gz"
## haproxy default timeouts
## haproxy default
# Set the number of retries to perform on a server after a connection failure
haproxy_retries: "3"
# Set the maximum inactivity time on the client side
haproxy_client_timeout: "50s"
# Set the maximum time to wait for a connection attempt to a server to succeed
haproxy_connect_timeout: "10s"
# Set the maximum allowed time to wait for a complete HTTP request
haproxy_http_request_timeout: "5s"
# Set the maximum inactivity time on the server side
haproxy_server_timeout: "50s"
## haproxy tuning params
haproxy_maxconn: 4096

View File

@ -28,11 +28,11 @@ defaults
log global
option dontlognull
option redispatch
retries 3
timeout client 50s
timeout connect 10s
retries {{ haproxy_retries }}
timeout client {{ haproxy_client_timeout }}
timeout connect {{ haproxy_connect_timeout }}
timeout http-request {{ haproxy_http_request_timeout }}
timeout server 50s
timeout server {{ haproxy_server_timeout }}
maxconn 4096
{% if haproxy_stats_enabled | bool %}