paulbsd-salt/states/haproxy/map.jinja

33 lines
990 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') -%}
2024-07-13 22:00:05 +02:00
{%- set country = salt['grains.get']('country') -%}
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
2023-09-14 16:45:28 +02:00
{% set servers_ip = [] %}
{%- for k,v in haproxy.servers.items() %}
{%- for i in v %}
{% set _ = servers_ip.append([k,i]) %}
{%- endfor %}
{%- endfor %}
{% do haproxy.config.servers.update({"hosts": servers_ip }) %}
{% do haproxy.config.update({"syscontact": salt['pillar.get']('syscontact', default='anonymous@example.com')}) %}