-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy_jinja_bk
62 lines (57 loc) · 1.75 KB
/
haproxy_jinja_bk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
global
log /dev/log local0
log /dev/log local1 notice
{% if haproxy_socket != '' %}
stats socket {{ haproxy_socket }} level admin
{% endif %}
{% if haproxy_chroot != '' %}
chroot {{ haproxy_chroot }}
{% endif %}
user {{ haproxy_user }}
group {{ haproxy_group }}
daemon
{% for global_var in haproxy_global_vars %}
{{ global_var }}
{% endfor %}
defaults
log global
mode http
option httplog
option dontlognull
{% if haproxy_version == '1.4' %}
contimeout 5000
clitimeout 50000
srvtimeout 50000
{% else %}
timeout connect 5000
timeout client 50000
timeout server 50000
{% endif %}
{% if ansible_os_family == 'Debian' %}
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
{% endif %}
frontend {{ haproxy_frontend_name }}
bind {{ haproxy_frontend_bind_address }}:{{ haproxy_frontend_port }}
mode {{ haproxy_frontend_mode }}
default_backend {{ haproxy_backend_name }}
option {{frontend_option_1}}
option {{frontend_option_2}}
backend {{ haproxy_backend_name }}
mode {{ haproxy_backend_mode }}
balance {{ haproxy_backend_balance_method }}
option forwardfor
{% if haproxy_backend_httpchk != '' %}
option httpchk {{ haproxy_backend_httpchk }}
{{ haproxy_backend_httpchk_expect_value }}
{{haproxy_backend_ssl_option}}
{% endif %}
cookie SERVERID insert indirect
{% for backend in haproxy_backend_servers %}
server {{ backend.name }} {{ backend.address }} cookie {{ backend.name }} check
{% endfor %}