2022-02-21 20:41:31 +00:00
|
|
|
---
|
|
|
|
|
2023-02-08 20:47:45 +00:00
|
|
|
- name: "Create directory for zone {{ zone.file | dirname }}"
|
2023-02-08 16:56:13 +00:00
|
|
|
ansible.builtin.file:
|
2022-02-21 20:41:31 +00:00
|
|
|
path: "{{ bind_config_directory }}/{{ zone.file | dirname }}"
|
|
|
|
owner: "{{ bind_unix_user }}"
|
|
|
|
group: "{{ bind_unix_group }}"
|
|
|
|
mode: 0755
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ view.zones }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: zone
|
2022-05-09 12:31:16 +00:00
|
|
|
when: zone.file is defined and zone.file | length > 0
|
2022-02-21 20:41:31 +00:00
|
|
|
|
2023-02-08 20:47:45 +00:00
|
|
|
- name: "Template view {{ view.name }}"
|
2023-02-08 16:56:13 +00:00
|
|
|
ansible.builtin.template:
|
2022-02-21 20:41:31 +00:00
|
|
|
src: "{{ inventory_hostname }}/etc/named/{{ zone.file }}.j2"
|
|
|
|
dest: "{{ bind_config_directory }}/{{ zone.file }}"
|
|
|
|
owner: "{{ bind_unix_user }}"
|
|
|
|
group: "{{ bind_unix_group }}"
|
|
|
|
mode: 0644
|
|
|
|
with_items:
|
|
|
|
- "{{ view.zones }}"
|
|
|
|
loop_control:
|
|
|
|
loop_var: zone
|
|
|
|
when: zone.type == 'master'
|
2023-02-08 16:56:13 +00:00
|
|
|
notify: restart named
|