summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/unbound.yml
blob: b4554ac80f6101d48bdd45d43b755a99078d72d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
- name: Install unbound
  apt: pkg={{ packages }}
  vars:
    packages:
    - unbound
    - dns-root-data

- name: Copy unbound configuration
  template: src=templates/etc/unbound/unbound.conf.j2
            dest=/etc/unbound/unbound.conf
            owner=root group=root
            mode=0644
  register: r
  notify:
    - Restart unbound

- name: Start unbound
  service: name=unbound state=started
  when: not r.changed

#- meta: flush_handlers

- name: Use the local DNS server
  lineinfile: dest=/etc/resolv.conf create=yes
              regexp='^nameserver\s+127\.0\.0\.1\s*$'
              line='nameserver 127.0.0.1'
              insertbefore='^\s*#*?nameserver\s'
              firstmatch=yes
  tags:
    - resolver
  notify:
    - Restart Postfix