# global global {%- if haproxy_global.log is string %} log {{ haproxy_global.log }} {%- else %} {%- for log_entry in haproxy_global.log %} log {{ log_entry }} {%- endfor %} {%- endif %} {%- if haproxy_global.stats_socket is defined %} stats socket {{ haproxy_global.stats_socket }} {%- endif %} {%- if haproxy_global.stats_timeout is defined and haproxy_global.stats_timeout != "" %} stats timeout {{ haproxy_global.stats_timeout }} {%- endif %} {%- if haproxy_global.chroot is defined %} chroot {{ haproxy_global.chroot }} {%- endif %} {%- if haproxy_global.user is defined %} user {{ haproxy_global.user }} {%- endif %} {%- if haproxy_global.group is defined %} group {{ haproxy_global.group }} {%- endif %} {%- if haproxy_global.daemon %} daemon {%- endif %} {%- if haproxy_global.pidfile is defined %} pidfile {{ haproxy_global.pidfile }} {%- endif %} {%- if haproxy_global.maxconn is defined %} maxconn {{ haproxy_global.maxconn }} {%- endif %} # default settings defaults log {{ haproxy_defaults.log }} mode {{ haproxy_defaults.mode }} {%- if haproxy_defaults.options is string %} option {{ haproxy_defaults.options }} {%- elif haproxy_defaults.options is defined %} {%- for option in haproxy_defaults.options %} option {{ option }} {%- endfor %} {%- elif haproxy_defaults.option is defined %} option {{ haproxy_defaults.option }} {%- endif %} {%- if haproxy_defaults.timeout_check is defined %} timeout check {{ haproxy_defaults.timeout_check }} {%- endif %} timeout connect {{ haproxy_defaults.timeout_connect }} timeout client {{ haproxy_defaults.timeout_client }} timeout server {{ haproxy_defaults.timeout_server }} {%- if haproxy_defaults.timeout_tunnel is defined and haproxy_defaults.timeout_tunnel != "" %} timeout tunnel {{ haproxy_defaults.timeout_tunnel }} {%- endif %} {%- if haproxy_stats.enabled %} # stats listen stats bind {{ haproxy_stats.bind }} mode {{ haproxy_stats.mode }} stats enable stats uri {{ haproxy_stats.uri }} {%- if haproxy_stats.show_node %} stats show-node {%- endif %} stats refresh {{ haproxy_stats.refresh }} stats auth {{ haproxy_stats.auth }} {%- endif %} {%- for frontend in haproxy_frontends %} # frontend - {{ frontend.name }} frontend {{ frontend.name }} bind {{ frontend.bind }} {%- if frontend.mode is defined %} mode {{ frontend.mode }} {%- endif %} {%- if frontend.options is defined %} {%- for option in frontend.options %} {{ option }} {%- endfor %} {%- endif %} default_backend {{ frontend.default_backend }} {%- endfor %} {%- for backend in haproxy_backends %} # backend {{ backend.name }} backend {{ backend.name }} {%- if backend.balance is defined %} balance {{ backend.balance }} {%- endif %} {%- if backend.hash_type is defined %} hash-type {{ backend.hash_type }} {%- endif %} {%- if backend.mode is defined %} mode {{ backend.mode }} {%- endif %} {%- if backend.stick_table is defined %} stick-table {{ backend.stick_table }} {%- endif %} {%- if backend.acls is defined %} {%- for acl in backend.acls %} acl {{ acl }} {%- endfor %} {%- endif %} {%- if backend.tcp_request is defined %} {%- for tcp_req in backend.tcp_request %} tcp-request {{ tcp_req }} {%- endfor %} {%- endif %} {%- if backend.tcp_response is defined %} {%- for tcp_resp in backend.tcp_response %} tcp-response {{ tcp_resp }} {%- endfor %} {%- endif %} {%- if backend.stick is defined %} {%- for stick in backend.stick %} stick {{ stick }} {%- endfor %} {%- endif %} {%- if backend.options is defined %} {%- for option in backend.options %} {{ option }} {%- endfor %} {%- endif %} {%- if backend.http_check is defined %} {%- for http_chk in backend.http_check %} http-check {{ http_chk }} {%- endfor %} {%- endif %} {%- if backend.tcp_check is defined %} {%- for tcp_chk in backend.tcp_check %} tcp-check {{ tcp_chk }} {%- endfor %} {%- endif %} {%- for server in backend.servers %} server {{ server.name }} {{ server.address }}{% if server.check | default(false) %} check{% endif %}{% if server.check_port is defined and server.check_port != "" %} port {{ server.check_port }}{% endif %}{% if server.send_proxy | default(false) %} send-proxy{% endif %}{% if server.extra_params is defined %} {{ server.extra_params }}{% endif %} {%- endfor %} {%- endfor %}