summaryrefslogtreecommitdiffstats
path: root/roles/common/tasks/resolved.yml
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-01-28 14:26:18 +0100
committerGuilhem Moulin <guilhem@fripost.org>2025-01-28 14:26:18 +0100
commit20cd6ac5299a725558a85df7c93c34f4a67b15d5 (patch)
treef5ed4fc68e9ff8b4e4f44db249285c7e0d5331d8 /roles/common/tasks/resolved.yml
parentbcae4845763a067cafaeb672f173ed810bacb242 (diff)
Resolver: Use systemd-resolved.
Diffstat (limited to 'roles/common/tasks/resolved.yml')
-rw-r--r--roles/common/tasks/resolved.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/roles/common/tasks/resolved.yml b/roles/common/tasks/resolved.yml
new file mode 100644
index 0000000..2834eaa
--- /dev/null
+++ b/roles/common/tasks/resolved.yml
@@ -0,0 +1,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