nsd/templates/config.j2
Baptiste Jonglez 3f225e7ec7 Remove deprecated dict.iteritems method
It caused ansible to fail with:

  fatal: [XXX]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'iteritems'"}

This method has been removed in Python3: https://docs.ansible.com/ansible/2.5/dev_guide/testing/sanity/no-dict-iteritems.html
2018-05-25 15:57:35 +02:00

34 lines
866 B
Django/Jinja

{# If value is a list, expand it by printing several (key, value) pairs. #}
{# Otherwise, just print the (key, value) pair unchanged. #}
{% macro expand_list(key, value) -%}
{% if value is string or value is number %}
{{ key }}: "{{ value }}"
{% else %}
{% for subvalue in value %}
{{ key }}: "{{ subvalue }}"
{% endfor %}
{% endif %}
{%- endmacro %}
# NSD configuration, automatically generated by Ansible.
# Do not edit by hand!
server:
{% if nsd_server_config is defined %}
# Common configuration
{% for key, value in nsd_server_config.items() -%}
{{ expand_list(key, value) }}
{%- endfor %}
{% endif %}
{% if nsd_local_server_config is defined %}
# Local configuration
{% for key, value in nsd_local_server_config.items() -%}
{{ expand_list(key, value) }}
{%- endfor %}
{% endif %}
# Include zone definitions
include: "{{ nsd_zones_config_file }}"