diff --git a/dhcp-server/isc-dhcp-server.service b/dhcp-server/isc-dhcp-server.service index 0c739dbb..8577e544 100644 --- a/dhcp-server/isc-dhcp-server.service +++ b/dhcp-server/isc-dhcp-server.service @@ -6,10 +6,11 @@ After=syslog.target network-online.target Type=forking User=root Group=root +{% set sites = salt['pillar.get']('netbox:config_context:sites').values()|sum(start=[]) -%} {% if 'vrf_external' in salt['grains.get']('ip_interfaces') %} -ExecStart=/sbin/ip vrf exec vrf_external /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf {% for site in salt['pillar.get']('netbox:config_context:sites') -%} br-{{ site }} {% endfor %} +ExecStart=/sbin/ip vrf exec vrf_external /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf {% for site in sites -%} br-{{ site }} {% endfor %} {% else %} -ExecStart=/usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf {% for site in salt['pillar.get']('netbox:config_context:sites') -%} br-{{ site }} {% endfor %} +ExecStart=/usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf {% for site in sites -%} br-{{ site }} {% endfor %} {% endif %} [Install] WantedBy=multi-user.target diff --git a/icinga2/host.conf.tmpl b/icinga2/host.conf.tmpl index f89cc999..53bb72a6 100644 --- a/icinga2/host.conf.tmpl +++ b/icinga2/host.conf.tmpl @@ -4,7 +4,7 @@ {%- set roles = salt['mine.get'](node_id,'minion_roles')[node_id] %} {%- set role = salt['mine.get'](node_id,'minion_role')[node_id] %} {%- set device_role = salt['mine.get'](node_id,'minion_device_role')[node_id] %} -{%- set sites = salt['pillar.get']('netbox:config_context:sites') %} +{%- set sites = salt['pillar.get']('netbox:config_context:sites').values()|sum(start=[]) %} {%- set address = salt['mine.get'](node_id,'minion_address', tgt_type='glob')[node_id] %} {%- set overlay_address = salt['mine.get'](node_id,'minion_overlay_address', tgt_type='glob')[node_id] %} {%- set address6 = salt['mine.get'](node_id,'minion_address6', tgt_type='glob')[node_id] %} diff --git a/radvd/radvd.conf b/radvd/radvd.conf index 0cb53799..8cbfb37b 100644 --- a/radvd/radvd.conf +++ b/radvd/radvd.conf @@ -2,7 +2,7 @@ # Managed by salt # -{% for site in salt['pillar.get']('netbox:config_context:sites') %} +{% for site in salt['pillar.get']('netbox:config_context:sites').values()|sum(start=[]) %} interface br-{{ site }} { AdvSendAdvert on; diff --git a/respondd/init.sls b/respondd/init.sls index 2246bd9f..9aff581e 100644 --- a/respondd/init.sls +++ b/respondd/init.sls @@ -10,7 +10,7 @@ python3-netifaces: pkg.installed -{% for site in salt['pillar.get']('netbox:config_context:sites') %} +{% for site in salt['pillar.get']('netbox:config_context:sites').values()|sum(start=[]) %} {% if not salt['file.directory_exists']('/opt/respondd-' ~ site ) %} /opt/respondd-{{ site }}: diff --git a/systemd-networkd/init.sls b/systemd-networkd/init.sls index 863ff9db..74d184f6 100644 --- a/systemd-networkd/init.sls +++ b/systemd-networkd/init.sls @@ -109,7 +109,7 @@ systemd-networkd-reload: - template: jinja interface: {{ iface }} mac: {{ interfaces[iface]['mac_address'] }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" - watch_in: - cmd: generate_initrd - cmd: systemd-networkd-reload @@ -123,7 +123,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "dummy" - watch_in: - cmd: systemd-networkd-reload @@ -134,7 +134,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "wireguard" - watch_in: - cmd: systemd-networkd-reload @@ -145,7 +145,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "vxlan" - watch_in: - cmd: systemd-networkd-reload @@ -156,7 +156,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "batadv" - watch_in: - cmd: systemd-networkd-reload @@ -167,7 +167,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "bridge" - watch_in: - cmd: systemd-networkd-reload @@ -178,7 +178,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-netdev.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" kind: "ip6gre" - watch_in: - cmd: systemd-networkd-reload @@ -190,7 +190,7 @@ systemd-networkd-reload: - source: salt://systemd-networkd/files/systemd-network.jinja2 - template: jinja interface: {{ iface }} - desc: {{ interfaces[iface]['description'] }} + desc: "{{ interfaces[iface]['description'] }}" ipaddresses: {{ interfaces[iface]['ipaddresses'] }} gateway: {{ gateway }} - watch_in: diff --git a/yanic/yanic.conf.tmpl b/yanic/yanic.conf.tmpl index a116c82d..f0f80c2d 100644 --- a/yanic/yanic.conf.tmpl +++ b/yanic/yanic.conf.tmpl @@ -13,12 +13,12 @@ synchronize = "1m" collect_interval = "1m" [respondd.sites.ffmuc] -domains = [{% for site in sites %}"ffmuc_{{ site }}", {% endfor %}] +domains = [{% for site, domains in sites.items() %}{% for domain in domains %}"{{site}}_{{ domain }}", {% endfor %}{% endfor %}] # interface that has an IP in your mesh network -{%- for site in sites %} +{%- for domain in sites.values()|sum(start=[]) %} [[respondd.interfaces]] -ifname = "br-{{ site }}" +ifname = "br-{{ domain }}" port = 45124 {% endfor %}