2 - name: install unbound
3 apt: name=unbound state=latest
5 - name: configure unbound
7 dest: /etc/unbound/unbound.conf.d/listen.conf
8 src: files/unbound/listen.conf
9 register: unbound_config
10 - name: restart unbound
11 # not a handler to make sure it succeeds before we go touch system DNS
12 when: unbound_config.changed
13 service: name=unbound state=restarted enabled=yes
15 - name: detect DHCP client
16 stat: path=/etc/dhcp/dhclient.conf
18 - name: configure DHCP
19 when: dhclient.stat.exists == True
21 dest: /etc/dhcp/dhclient.conf
22 src: files/unbound/dhclient.conf
23 - name: configure system DNS
25 dest: /etc/resolv.conf
26 content: "nameserver 127.0.0.2\n"