paulbsd-salt/states/haproxy/templates/spoe.cfg.j2
2023-02-04 19:51:20 +01:00

25 lines
834 B
Django/Jinja

## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "haproxy/map.jinja" import haproxy with context %}
{% for name, values in haproxy.config.spoe.items() -%}
[{{ name }}]
spoe-agent {{ name }}
messages {{ " ".join(values.messages.keys()) }}
option var-prefix {{ name }}
log global
timeout hello {{ values.timeout_hello|default("2s") }}
timeout idle {{ values.timeout_idle|default("2m") }}
timeout processing {{ values.timeout_processing|default("300ms") }}
use-backend {{ name }}
{% for m, m_values in values.messages.items() -%}
spoe-message {{ m }}
{%- if m_values.args.keys()|length > 0 %}
args {% for i,v in m_values.args.items() %}{{ "{}={}".format(i,v) }} {% endfor %}
{%- endif %}
{%- if m_values.event %}
event {{ m_values.event }}
{%- endif %}
{% endfor -%}
{% endfor -%}