]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/add-dns-domain/tasks/main.yml
Feat: Gather facts and use default IPv4 address
[ansible.git] / playbooks / debian / roles / add-dns-domain / tasks / main.yml
1 - name: Check domain
2   stat:
3     path: "/etc/bind/{{ domain }}"
4   register: domain_exists
5
6 - name: Copy domain template
7   become: true
8   template:
9     src: domain
10     dest: "/etc/bind/{{ domain }}"
11     owner: bind
12     group: bind
13     mode: '0600'
14     force: no
15   when: not domain_exists.stat.exists
16
17 - name: Update config
18   become: true
19   shell: |
20     echo '
21
22     zone "{{ domain }}" {
23           type master;
24           file "/etc/bind/{{ domain }}";
25           allow-query { any; };
26           notify yes;
27     };' >> /etc/bind/named.conf.local
28
29
30   when: not domain_exists.stat.exists
31
32 - name: Reload BIND
33   become: true
34   service:
35     name: bind9
36     state: reloaded
37   when: not domain_exists.stat.exists