paulbsd-salt/states/haproxy/map.jinja

23 lines
719 B
Plaintext
Raw Normal View History

2022-10-01 20:06:19 +02:00
{%- import_yaml "haproxy/defaults.yaml" as defaults -%}
2023-02-10 13:47:00 +01:00
{%- set haproxy = salt['pillar.get']('haproxy',
default=defaults.haproxy,
merge=True) -%}
2022-10-01 20:06:19 +02:00
{%- set users = salt['pillar.get']('htpasswds') -%}
2023-02-04 19:51:20 +01:00
{%- set net = salt['pillar.get']('net') -%}
2023-03-10 00:02:52 +01:00
{%- set fqdn = salt['grains.get']('fqdn') -%}
2023-02-04 19:51:20 +01:00
{% set peers_ip = [] %}
2023-03-21 19:42:51 +01:00
{%- for k,v in haproxy.peers.items() %}
{%- if k != fqdn %}
2023-02-04 19:51:20 +01:00
{%- for i in v %}
{% set _ = peers_ip.append([k,i]) %}
{%- endfor %}
{%- endif %}
{%- endfor %}
2023-03-21 19:42:51 +01:00
{% do haproxy.config.peers.update({"hosts": peers_ip }) %}
2023-04-13 23:13:34 +02:00
{% do haproxy.config.update({"syscontact": salt['pillar.get']('syscontact',default='anonymous@example.com')}) %}