You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB
YAML

---
- name: Create zone directory writeable
file:
path: "{{ domain_directory }}"
state: directory
owner: root
group: "{{ dns_user }}"
mode: u=rwx,g=rwx,o=
- name: Create other zone directories readable
file:
path: "{{ item }}"
state: directory
owner: root
group: "{{ dns_user }}"
mode: u=rwx,g=rx,o=
loop:
- "{{ keys_directory }}"
- "{{ domain_environment_directory }}"
- name: Determine if keys are generated already
find:
paths: "{{ keys_directory }}"
patterns: "K{{ domain }}.+*+*"
register: keys_found
- name: Generate keys for zone {{ domain }}
include_tasks: generate_keys.yml
when: keys_found.matched < 2
- name: Store main database of zone {{ domain }}
template:
src: zone.db
dest: "{{ domain_environment_directory }}/0_main.db"
owner: root
group: "{{ dns_user }}"
mode: "u=rw,g=r,o=r"
validate: "named-checkzone {{ domain }} %s"
notify: rebuild dns zones
- name: Configure zone {{ domain }}
template:
src: zone.conf
dest: "{{ configuration_file }}"
owner: root
group: "{{ dns_user }}"
mode: "u=rw,g=r,o=r"
validate: "named-checkconf %s"
notify: reload bind9
- name: Include configuration file of zone {{ domain }}
lineinfile:
path: "{{ zones_configuration }}"
state: present
line: "include \"{{ configuration_file }}\";"
validate: "named-checkconf %s"
notify: reload bind9
- meta: flush_handlers