2 - name: install unbound
3 apt: name=unbound state=latest
5 - name: configure unbound
6 register: unbound_config
8 dest: /etc/unbound/unbound.conf.d/listen.conf
9 src: files/unbound/listen.conf
10 - name: configure systemd (create dir)
11 file: path=/etc/systemd/system/unbound.service.d state=directory
12 - name: configure systemd (tweak unbound)
13 register: unbound_systemd
15 dest: /etc/systemd/system/unbound.service.d/override.conf
16 src: files/unbound/unbound.service.override
17 - name: reload systemd
18 when: unbound_systemd.changed
19 command: systemctl daemon-reload
20 - name: restart unbound
21 # not a handler to make sure it succeeds before we go touch system DNS
22 when: unbound_config.changed
23 service: name=unbound state=restarted enabled=yes
25 - name: detect DHCP client
26 stat: path=/etc/dhcp/dhclient.conf
28 - name: configure DHCP
29 when: dhclient.stat.exists == True
31 dest: /etc/dhcp/dhclient.conf
32 src: files/unbound/dhclient.conf
33 - name: configure system DNS
35 dest: /etc/resolv.conf
36 content: "nameserver 127.0.0.2\n"