summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/resolved.yml
blob: 2834eaa072a6bec456914940353e013d7f0f5eed (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
33
34
35
36
- name: Install systemd-resolved
  apt: pkg={{ packages }}
  vars:
    packages:
    - systemd-resolved
    - libnss-resolve
    - libnss-myhostname

- name: Create directory /etc/systemd/resolved.conf.d
  file: path=/etc/systemd/resolved.conf.d
        state=directory
        owner=root group=root
        mode=0755

- name: Configure systemd-resolved
  template: src=etc/systemd/resolved.conf.d/local.conf.j2
            dest=/etc/systemd/resolved.conf.d/local.conf
            owner=root group=root
            mode=0644
  notify:
    - Restart systemd-resolved

- name: Start systemd-resolved
  service: name=systemd-resolved.service enabled=true state=started

- meta: flush_handlers

- name: Remove resolvconf
  apt: pkg=resolvconf state=absent purge=yes

- name: Configure /etc/nsswitch.conf
  lineinfile: "dest=/etc/nsswitch.conf create=no
               regexp='^(hosts:\\s+).*'
               line='\\1resolve [!UNAVAIL=return] files myhostname dns'
               backrefs=true"
  tags: nsswitch