blob: 4167a2fd04184ab90cf2ea14c3636cfe1b1a87bf [file] [log] [blame]
Martin Polreicheef51a12019-04-17 11:31:01 +02001{% set stats_socket_default = '/run/haproxy/admin.sock' %}
2{% set cpu_map_pillar = salt['pillar.get'](key='haproxy:proxy:cpu_map', default={}) %}
3{% set cpu_map_default = [] %}
4
5{% if cpu_map_pillar|length > 0 %}
6 {%- for process, cpu in cpu_map_pillar.items() %}
7 {{ cpu_map_default.append(process|string+' '+cpu|string) }}
8 {%- endfor %}
9{% endif %}
10
11{% set global_parameters = {
12 'chroot': '/var/lib/haproxy',
13 'daemon': true,
14 'group': 'haproxy',
15 'cpu-map': cpu_map_pillar,
16 'log': [
Martin Polreich6d337fa2019-04-30 13:41:39 +020017 '/dev/log local0',
18 '/dev/log local1 notice',
Martin Polreicheef51a12019-04-17 11:31:01 +020019 ],
20 'log-send-hostname': '',
21 'nbproc': salt['pillar.get'](key='haproxy:proxy:nbproc', default=''),
22 'pidfile': '/var/run/haproxy.pid',
23 'user': 'haproxy',
24 'stats': [
25 'socket ' + salt['pillar.get'](key='haproxy:proxy:stats_socket', default=stats_socket_default) + ' mode 660 level admin',
26 'timeout 30s',
27 'bind-process ' + salt['pillar.get'](key='haproxy:proxy:stats_bind_process', default=''),
28 ],
29 'maxconn': 25000,
30 'spread-checks': 4,
31 'tune_bufsize': 32768,
32 'tune_maxrewrite': 1024,
33 }
34%}
35
Filip Pytloun48d38302015-10-06 16:28:31 +020036{% set proxy = salt['grains.filter_by']({
37 'Debian': {
38 'pkgs': ['haproxy'],
39 'service': 'haproxy',
Martin Polreicheef51a12019-04-17 11:31:01 +020040 'stats_socket': stats_socket_default,
41 'global': global_parameters
Filip Pytloun48d38302015-10-06 16:28:31 +020042 },
43 'RedHat': {
44 'pkgs': ['haproxy'],
45 'service': 'haproxy',
Martin Polreicheef51a12019-04-17 11:31:01 +020046 'stats_socket': stats_socket_default,
47 'global': global_parameters
Filip Pytloun48d38302015-10-06 16:28:31 +020048 },
49}, merge=salt['pillar.get']('haproxy:proxy')) %}
Oleg Gelbukhb9bb39b2018-10-17 17:10:16 +040050
Michel Nederlof14da7092018-03-12 22:46:36 +010051{% set invalid_section_options = {
52 'frontend': [
53 'abortonclose',
54 'accept-invalid-http-response',
55 'allbackups',
56 'checkcache',
57 'external-check',
58 'httpchk',
59 'ldap-check',
60 'log-health-checks',
61 'mysql-check',
62 'persist',
63 'pgsql-check',
64 'prefer-last-server',
65 'redis-check',
66 'redispatch',
67 'smtpchk',
68 'srvtcpka',
69 'ssl-hello-chk',
70 'tcp-check',
71 'tcp-smart-connect',
72 'tcpka',
73 'tcplog',
74 'transparent',
75 ],
76 'backend': [
77 'accept-invalid-http-request',
78 'clitcpka',
79 'contstats',
80 'dontlog-normal',
81 'dontlognull',
82 'http-ignore-probes',
83 'http-use-proxy-header',
84 'log-separate-errors',
85 'logasap',
86 'socket-stats',
87 'tcp-smart-accept',
88 'tcpka',
89 'tcplog',
90 ],
91}
92%}