diff --git a/templates/primary_zone_config.j2 b/templates/primary_zone_config.j2 index a949584..09b47c2 100644 --- a/templates/primary_zone_config.j2 +++ b/templates/primary_zone_config.j2 @@ -1,6 +1,6 @@ # Primary zone definition for {{ item.zone_name }} -{% for slave in item.slaves %} +{% for slave in item.slaves|default([]) %} {% if slave.tsig_secret is defined %} key: name: "{{ item.zone_name }}_{{ slave.ip }}" @@ -16,7 +16,7 @@ key: zone: name: "{{ item.zone_name }}" zonefile: "{{ primary_zones_dir }}/{{ item.zone_filename }}" -{% for slave in item.slaves %} +{% for slave in item.slaves|default([]) %} notify: {{ slave.ip }} "{{ tsigkey(slave) }}" provide-xfr: {{ slave.ip }} "{{ tsigkey(slave) }}" {% endfor %} diff --git a/templates/secondary_zone_config.j2 b/templates/secondary_zone_config.j2 index d468806..22a652c 100644 --- a/templates/secondary_zone_config.j2 +++ b/templates/secondary_zone_config.j2 @@ -1,6 +1,6 @@ # Secondary zone definition for {{ item.zone_name }} -{% for master in item.masters %} +{% for master in item.masters|default([]) %} {% if master.tsig_secret is defined %} key: name: "{{ item.zone_name }}_{{ master.ip }}" @@ -16,7 +16,7 @@ key: zone: name: "{{ item.zone_name }}" zonefile: "{{ secondary_zones_dir }}/{{ item.zone_name }}" -{% for master in item.masters %} +{% for master in item.masters|default([]) %} allow-notify: {{ master.ip }} "{{ tsigkey(master) }}" request-xfr: AXFR {{ master.ip }} "{{ tsigkey(master) }}" {% endfor %}