Connect syndic minions to syndic master
All checks were successful
ci/lysergic/push/pipeline Pipeline was successful

Syndics are generally the masters assigned to their region.
We want the minions on syndics to connect to their upstream master
("master of masters") instead of to themselves.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-22 19:20:53 +01:00
parent a5754ea0cb
commit 2e08c3cf36
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -1,7 +1,17 @@
{%- set netbox_pillar = salt['pillar.get']('netbox') -%}
{%- if 'custom_fields' in netbox_pillar and 'salt.syndic' in netbox_pillar['custom_fields']['salt_roles'] -%}
{%- set master = salt['pillar.get']('salt:master:syndic_master') -%}
{%- elif 'config_context' in netbox_pillar -%}
{%- set master = netbox_pillar['config_context']['salt_master'] -%}
{%- else -%}
{%- do salt.log.warning('Could not determine Salt master') -%}
{%- set master = 'FIX-ME.lysergic.dev' -%}
{%- endif -%}
/etc/salt/minion.d/master.conf:
file.managed:
- contents:
- 'master: {{ salt['pillar.get']('netbox:config_context:salt_master') }}'
- 'master: {{ master }}'
- require_in:
- service: salt-minion
- watch_in: