feat: add teleport like configs

This commit is contained in:
Simon Cornet 2026-04-17 13:49:26 +02:00
commit 1fa9c044d0
4 changed files with 158 additions and 113 deletions

View file

@ -1,29 +1,57 @@
# 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.chroot is defined %}
chroot {{ haproxy_global.chroot }}
pidfile {{ haproxy_global.pidfile }}
maxconn {{ haproxy_global.maxconn }}
group {{ haproxy_global.group }}
{%- 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 %}
stats socket {{ haproxy_global.stats_socket }}
{%- 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 }}
timeout check {{ haproxy_defaults.timeout_check }}
timeout connect {{ haproxy_defaults.timeout_connect }}
timeout client {{ haproxy_defaults.timeout_client }}
timeout server {{ haproxy_defaults.timeout_server }}
{%- 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 %}
@ -104,9 +132,21 @@ backend {{ backend.name }}
{{ 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.send_proxy | default(false) %} send-proxy{% endif %}{% if server.check | default(false) %} check{% endif %}{% if server.extra_params is defined %} {{ server.extra_params }}{% endif %}
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 %}