diff --git a/salt-pillar/bind/dns.sls b/salt-pillar/bind/dns.sls index 8f81020..b366fe0 100644 --- a/salt-pillar/bind/dns.sls +++ b/salt-pillar/bind/dns.sls @@ -4,6 +4,13 @@ bind: public-ns: - ns.c3d2.de - spaceboyz.net + slaves: + # bind.wetu.c3d2.de + - 172.22.100.9 + - fd23:42:c3d2::1 + # dns.spaceboyz.net + - 172.22.24.4 + - 2a01:4f8:a0:33d0::4 serial: 2017012300 reverse-zones-inet: diff --git a/salt/bind/named.conf b/salt/bind/named.conf index f655f4d..bf1744a 100644 --- a/salt/bind/named.conf +++ b/salt/bind/named.conf @@ -1,7 +1,23 @@ +{% macro slaves() -%} +{%- if pillar['bind']['slaves'] -%} + allow-transfer { +{%- for addr in pillar['bind']['slaves'] -%} + {{ addr }}; +{%- endfor -%} + }; + also-notify { +{%- for addr in pillar['bind']['slaves'] -%} + {{ addr }}; +{%- endfor -%} + }; +{%- endif -%} +{%- endmacro %} + {%- set domain = pillar['bind']['root-domain'] %} zone "{{ domain }}" IN { type master; file "/etc/bind/{{ domain }}.zone"; + {{ slaves() }} }; {%- for net, subnet4 in pillar['subnets-inet'].items() %} @@ -9,6 +25,7 @@ zone "{{ domain }}" IN { zone "{{ domain }}" IN { type master; file "/etc/bind/{{ domain }}.zone"; + {{ slaves() }} }; {%- endfor %}