--- - name: Store mapping for dns server in local list copy: content: "{{ inventory_hostname }}\n" dest: "{{ dns_list_file }}" owner: "{{ local_user }}" group: "{{ local_user }}" mode: "u=rw,g=r,o=" delegate_to: localhost - name: Create zone directory file: path: "{{ domain_directory }}" state: directory owner: root group: "{{ dns_user }}" mode: u=rwx,g=rx,o= - name: Create data directory file: path: "{{ data_directory }}" state: directory owner: "{{ dns_user }}" group: "{{ dns_user }}" mode: u=rwx,g=rx,o= - name: Create key directory file: path: "{{ keys_directory }}" state: directory owner: "{{ dns_user }}" group: "{{ dns_user }}" mode: u=rwx,g=rx,o= # TODO Copy public ZSK to localhost - name: Store database of zone {{ domain }} template: src: zone.db dest: "{{ database_file }}" owner: "{{ dns_user }}" group: "{{ dns_user }}" mode: u=rw,g=r,o= force: no # Do not override dynamic changes validate: "named-checkzone {{ domain }} %s" notify: reload bind9 - 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 - name: Configure additional records import_role: name: dns/entries vars: # domain # entries