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') -%}
|
|
|
|
|
|
|
|
{% set peers = salt['mine.get'](
|
2023-02-10 13:47:00 +01:00
|
|
|
tgt='G@lb:true',
|
|
|
|
fun='internal_ip_addrs',
|
|
|
|
tgt_type='compound') %}
|
2023-02-04 19:51:20 +01:00
|
|
|
|
|
|
|
{% set peers_ip = [] %}
|
|
|
|
{%- for k,v in peers.items() %}
|
|
|
|
{%- if k != salt['grains.get']('fqdn') %}
|
|
|
|
{%- for i in v %}
|
|
|
|
{% set _ = peers_ip.append([k,i]) %}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
{% do haproxy.config.update({"peers": peers_ip }) %}
|