Fix templates if there is no slave or master defined

This commit is contained in:
Baptiste Jonglez 2016-03-26 18:42:13 +01:00
parent 3bfcbc9d91
commit 0e6f8b9ad2
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Primary zone definition for {{ item.zone_name }} # Primary zone definition for {{ item.zone_name }}
{% for slave in item.slaves %} {% for slave in item.slaves|default([]) %}
{% if slave.tsig_secret is defined %} {% if slave.tsig_secret is defined %}
key: key:
name: "{{ item.zone_name }}_{{ slave.ip }}" name: "{{ item.zone_name }}_{{ slave.ip }}"
@ -16,7 +16,7 @@ key:
zone: zone:
name: "{{ item.zone_name }}" name: "{{ item.zone_name }}"
zonefile: "{{ primary_zones_dir }}/{{ item.zone_filename }}" zonefile: "{{ primary_zones_dir }}/{{ item.zone_filename }}"
{% for slave in item.slaves %} {% for slave in item.slaves|default([]) %}
notify: {{ slave.ip }} "{{ tsigkey(slave) }}" notify: {{ slave.ip }} "{{ tsigkey(slave) }}"
provide-xfr: {{ slave.ip }} "{{ tsigkey(slave) }}" provide-xfr: {{ slave.ip }} "{{ tsigkey(slave) }}"
{% endfor %} {% endfor %}

View File

@ -1,6 +1,6 @@
# Secondary zone definition for {{ item.zone_name }} # Secondary zone definition for {{ item.zone_name }}
{% for master in item.masters %} {% for master in item.masters|default([]) %}
{% if master.tsig_secret is defined %} {% if master.tsig_secret is defined %}
key: key:
name: "{{ item.zone_name }}_{{ master.ip }}" name: "{{ item.zone_name }}_{{ master.ip }}"
@ -16,7 +16,7 @@ key:
zone: zone:
name: "{{ item.zone_name }}" name: "{{ item.zone_name }}"
zonefile: "{{ secondary_zones_dir }}/{{ 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) }}" allow-notify: {{ master.ip }} "{{ tsigkey(master) }}"
request-xfr: AXFR {{ master.ip }} "{{ tsigkey(master) }}" request-xfr: AXFR {{ master.ip }} "{{ tsigkey(master) }}"
{% endfor %} {% endfor %}