full-dns/tasks/nsd_satellite.yml

45 lines
1.1 KiB
YAML

---
- name: Ensure satellite nsd conf is present
template:
src: templates/nsd-satellite.conf.j2
dest: /etc/nsd/nsd.conf.d/01-satellite.conf
owner: root
group: root
mode: 0600
notify: restart nsd
- name: Ensure zones src directory is present
file:
path: /etc/nsd/src_zones
state: directory
owner: root
group: root
mode: 0750
- name: Ensure main zone stub is present
template:
src: templates/zone_stub.conf.j2
dest: "/etc/nsd/src_zones/{{ main_zone.name }}.conf"
owner: root
group: root
mode: 0640
vars:
name: "{{ main_zone.name }}"
mx_records: "{{ main_zone.records|json_query('[?type==`MX`]') }}"
records: "{{ main_zone.records|json_query('[?type!=`MX`]') }}"
notify: restart dns
- name: Ensure zones stubs are present
template:
src: templates/zone_stub.conf.j2
dest: "/etc/nsd/src_zones/{{ item.name }}.conf"
owner: root
group: root
mode: 0640
vars:
name: "{{ item.name }}"
mx_records: "{{ item.records|json_query('[?type==`MX`]') }}"
records: "{{ item.records|json_query('[?type!=`MX`]') }}"
loop: "{{ zones }}"
notify: restart dns