From 22d1ae642daf7cc6b3f7897f50bac3941e336f5c Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Thu, 21 Aug 2025 02:51:30 +0200 Subject: Fix network role to install via chroot The removal of the resolv.conf DNS configuration is required by the wireguard not to have conflicting DNS configuration resolvers between the static system fallback and the NetworkManager resolver (using systemd-resolved) and the VPN DNS --- roles/network/tasks/main.yml | 8 ++++++-- roles/network/vars/debian.yml | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 60f81c99..fd2553ff 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -38,7 +38,6 @@ state: "stopped" with_items: "{{ network_disabled_services }}" when: not ansible_is_chroot - failed_when: false - name: "(chroot): Ensure network disabled services are disabled" ansible.builtin.command: @@ -46,7 +45,6 @@ changed_when: true with_items: "{{ network_disabled_services }}" when: ansible_is_chroot - failed_when: false # noqa: command-instead-of-module module doesn't work inside chroot - name: "Configure NetworkManager" @@ -56,6 +54,12 @@ - "Restart NetworkManager" - "Restart systemd-resolved" block: + - name: "Remove resolv.conf symlink" + ansible.builtin.file: + path: "/etc/resolv.conf" + state: "absent" + when: not ansible_is_chroot + - name: "Configure systemd-resolved" ansible.builtin.template: src: "resolved.conf.j2" diff --git a/roles/network/vars/debian.yml b/roles/network/vars/debian.yml index 34768d95..d77d59c9 100644 --- a/roles/network/vars/debian.yml +++ b/roles/network/vars/debian.yml @@ -11,7 +11,5 @@ network_enabled_services: network_disabled_services: - "dhcpcd" - - "avahi-daemon" - "networking" - - "resolvconf" - "systemd-networkd" -- cgit v1.2.3