Use defaults/main.yml to avoid checking for empty lists everywhere

This fixes one task that was failing when no primary zone was defined (the
task copying zone files)
This commit is contained in:
Baptiste Jonglez 2017-09-01 22:39:51 +02:00
parent e8211c720d
commit 4b6015abfc
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,9 @@
---
nsd_primary_zones: []
nsd_secondary_zones: []
nsd_tsig_keys: []
# Default variables, suitable for nsd4 on Debian (jessie or above)
nsd_version: 4

View File

@ -5,7 +5,7 @@
# definitions for all zones (primary and secondary) and TSIG keys.
## TSIG keys ##
{% for key in nsd_tsig_keys|default([]) %}
{% for key in nsd_tsig_keys %}
key:
name: "{{ key.tsig_keyname }}"
secret: "{{ key.tsig_secret }}"
@ -16,7 +16,7 @@ key:
## Primary zones ##
{% for zone in nsd_primary_zones|default([]) %}
{% for zone in nsd_primary_zones %}
# Primary zone definition for {{ zone.zone_name }}
zone:
name: "{{ zone.zone_name }}"
@ -31,7 +31,7 @@ zone:
## Secondary zones ##
{% for zone in nsd_secondary_zones|default([]) %}
{% for zone in nsd_secondary_zones %}
# Secondary zone definition for {{ zone.zone_name }}
zone:
name: "{{ zone.zone_name }}"