From 34fbb949e9ecd1f6fdce5f5cbbac83fde811cd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= <tobbez@ryara.net> Date: Fri, 22 Apr 2022 23:25:10 +0200 Subject: [PATCH] Disable systemd-resolved Previously, systemd-resolved was installed, but not used. Starting with systemd-resolved-249.11-1.fc35.x86_64, this changed due to this change: > Create /etc/resolv.conf symlink if nothing is present yet (#2032085) More context in: https://bugzilla.redhat.com/show_bug.cgi?id=2032085 Before this version, resolv.conf was a regular file managed by NetworkManager. This commit restores the previous behvaiour by disabling systemd-resolved, removing /etc/resolv.conf if it is a symlink, and restarting NetworkManager (so it creates a new resolv.conf). --- manifests/public_ip.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/manifests/public_ip.pp b/manifests/public_ip.pp index c423c13..d1cab32 100644 --- a/manifests/public_ip.pp +++ b/manifests/public_ip.pp @@ -17,6 +17,18 @@ class lysnetwork::public_ip ( ipv6_dns_servers => ['2001:6b0:17:f0a0::4', '2001:6b0:17:f0a0::e1'], ipv6_dns_search => 'lysator.liu.se', } + # disable systemd-resolved + service { 'systemd-resolved': + ensure => stopped, + enable => false, + } + -> exec { '/usr/bin/rm -f /etc/resolv.conf': + onlyif => '/usr/bin/test -h /etc/resolv.conf', + } + # avoid managing the service by using an exec resource + ~> exec { '/usr/bin/systemctl restart NetworkManager': + refreshonly => true, + } } elsif versioncmp($facts['systemd_version'], '215') >= 0 { case $facts['os']['family'] { 'RedHat': { -- GitLab