Write zone files

This commit is contained in:
s3lph 2020-11-20 01:34:40 +01:00
parent 343c576ff0
commit ffe2555d8a
2 changed files with 36 additions and 0 deletions

View file

@ -17,6 +17,26 @@
group: knot group: knot
mode: 0750 mode: 0750
- name: create knot zone directory
file:
path: /var/lib/knot/master
state: directory
owner: knot
group: knot
mode: 0750
- name: render knot zone files
template:
src: var/lib/knot/master/zone.j2
dest: "/var/lib/knot/master/{{ zone.name }}"
owner: knot
group: knot
mode: 0640
vars:
zone: "hostvars[inventory_hostname]['knot_zone_' + item]"
loop: "{{ knot_zone_groups | subelements(zones) }}"
notify: reload knot
- name: render knot server config - name: render knot server config
template: template:
src: etc/knot/knot.d/00-server.conf.j2 src: etc/knot/knot.d/00-server.conf.j2

View file

@ -0,0 +1,16 @@
$TTL {{ zone.soa.ttl }}
@ {{ zone.soa.class }} SOA {{ primary }} {{ zone.soa.rname }} (
{{ ansible_date_time.epoch }} ; serial
{{ zone.soa.refresh }} ; refresh
{{ zone.soa.retry }} ; retry
{{ zone.soa.expire }} ; expire
{{ zone.soa.min_ttl }} ; min ttl
)
{% for r in zone.records %}
{{ r.name }} {{ r.ttl|default('') }} {{ r.class|default('') }} {{ r.type }} {{ r.content }}
{% endfor %}