dns-witch-zones/config/roles/knot/templates/knot.conf.j2

45 lines
1.6 KiB
Django/Jinja

server:
rundir: "/run/knot"
user: knot:knot
listen: [ 0.0.0.0@53, ::@53 ]
log:
- target: syslog
any: info
remote:
{% for host in groups.all %}
- id: {{ hostvars[host].ansible_hostname }}
address: [ {{ ( hostvars[host].ansible_all_ipv4_addresses + hostvars[host].ansible_all_ipv6_addresses ) | ansible.netcommon.ipaddr('public') | join(', ') }} ]
{% endfor %}
acl:
{% for host in groups.all %}
- id: {{ hostvars[host].ansible_hostname }}
address: [ {{ ( hostvars[host].ansible_all_ipv4_addresses + hostvars[host].ansible_all_ipv6_addresses ) | ansible.netcommon.ipaddr('public') | join(', ') }} ]
action: {% if host in groups.secondary %} transfer {% elif host in groups.primary %} notify {% endif %}
{% endfor %}
template:
- id: default
storage: "/var/lib/knot"
file: "zones/%s.zone"
{% if inventory_hostname in groups.primary %}
zonefile-load: difference-no-serial
dnssec-signing: on
dnssec-policy: default
notify: [ {{ groups.secondary | map('extract', hostvars) | map(attribute='ansible_hostname') | join(', ') }} ]
acl: [ {{ groups.secondary | map('extract', hostvars) | map(attribute='ansible_hostname') | join(', ') }} ]
{% endif %}
{% if inventory_hostname in groups.secondary %}
master: [ {{ groups.primary | map('extract', hostvars) | map(attribute='ansible_hostname') | join(', ') }} ]
acl: [ {{ groups.primary | map('extract', hostvars) | map(attribute='ansible_hostname') | join(', ') }} ]
{% endif %}
zone:
{% for zone in zones %}
- domain: {{ zone | basename | splitext | first }}
{% endfor %}