]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/named/tasks/main.yml
Feat(apt): Remove option `purge`
[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 || :"
4   register: named_conf
5   changed_when: named_conf.stdout in ('', "0")
6
7 - debug:
8     msg: "BIND has already been configured"
9   when: named_conf.stdout not in ('', "0")
10
11 - block:
12     - name: Install BIND
13       become: true
14       apt:
15         autoclean: yes
16         autoremove: yes
17         install_recommends: no
18         name: bind9
19         state: latest
20         update_cache: yes
21
22     - name: Configure BIND
23       become: true
24       copy:
25         src: named.conf.options
26         dest: /etc/bind/named.conf.options
27         owner: bind
28         group: bind
29         mode: '0600'
30
31     - name: Reload BIND
32       become: true
33       service:
34         name: bind9
35         state: reloaded
36
37     - name: Configure resolver
38       become: true
39       copy:
40         content: "nameserver 127.0.0.1"
41         dest: /etc/resolv.conf
42         owner: root
43         group: root
44         mode: '0644'
45   when: named_conf.stdout in ('', "0")