]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/named/tasks/main.yml
Fix(named): Become root
[ansible.git] / playbooks / debian / roles / named / tasks / main.yml
1 - name: Check named.conf.options
2   become: true
3   shell: "grep -c '^\\s*allow-query' /etc/bind/named.conf.options || echo 0"
4   register: named_conf
5   changed_when: named_conf.stdout == "0"
6
7 - debug:
8     msg: "BIND has already been configured"
9   when: named_conf.stdout != "0"
10
11 - name: Install BIND
12   become: true
13   apt:
14     autoclean: yes
15     autoremove: yes
16     install_recommends: no
17     name: bind9
18     purge: yes
19     state: latest
20     update_cache: yes
21   when: named_conf.stdout == "0"
22
23 - name: Configure BIND
24   become: true
25   copy:
26     src: named.conf.options
27     dest: /etc/bind/named.conf.options
28     owner: bind
29     group: bind
30     mode: '0600'
31   when: named_conf.stdout == "0"
32
33 - name: Reload BIND
34   become: true
35   service:
36     name: bind9
37     state: reloaded
38   when: named_conf.stdout == "0"