make sure dhclient does not give us another DNS server
[ansible.git] / roles / postfix / tasks / unbound.yml
1 # install
2 - name: install unbound
3   apt: name=unbound state=latest
4 # configure
5 - name: configure unbound
6   copy:
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
14 # use as system DNS
15 - name: detect DHCP client
16   stat: path=/etc/dhcp/dhclient.conf
17   register: dhclient
18 - name: configure DHCP
19   when: dhclient.stat.exists == True
20   copy:
21     dest: /etc/dhcp/dhclient.conf
22     src: files/unbound/dhclient.conf
23 - name: configure system DNS
24   copy:
25     dest: /etc/resolv.conf
26     content: "nameserver 127.0.0.2\n"