ansible-collection-nameserver/roles/knot/tasks/config.yml
2021-01-16 02:00:19 +01:00

35 lines
1,004 B
YAML

---
- name: create knot zone directories
file:
path: "{{ item }}"
state: directory
owner: knot
group: knot
mode: 0750
loop:
- "{{ knot_zone_master_storage_path }}"
- "{{ knot_zone_replica_storage_path }}"
- name: render knot zone files
template:
src: var/lib/knot/master/zone.j2
dest: "{{ knot_zone_master_storage_path }}/{{ item.name }}.zone"
owner: knot
group: knot
mode: 0640
validate: /usr/bin/kzonecheck -v %s
when: "inventory_hostname in item.masters"
loop: "{{ hostvars[inventory_hostname] | dict2items | selectattr('key', 'match', '^knot_zone_.+$') | map(attribute='value') | list }}"
notify: reload knot
- name: render knot master config
template:
src: etc/knot/knot.conf.j2
dest: /etc/knot/knot.conf
owner: knot
group: knot
mode: 0640
vars:
zones: "{{ hostvars[inventory_hostname] | dict2items | selectattr('key', 'match', '^knot_zone_.+$') | map(attribute='value') | list }}"
notify: reload knot