From cd49c82ce79d36fc10251063a19a403d816c667e Mon Sep 17 00:00:00 2001 From: Matt Crees Date: Mon, 15 Jul 2024 10:43:50 +0100 Subject: [PATCH] Fix permanently enabling systemd-networkd Work around the service module not yet handling "enabled-runtime" properly. This patch should be reverted when the following can be used: https://github.com/ansible/ansible/pull/77754 --- roles/systemd_networkd/tasks/main.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/roles/systemd_networkd/tasks/main.yml b/roles/systemd_networkd/tasks/main.yml index fe7ac5a..9ca94dd 100644 --- a/roles/systemd_networkd/tasks/main.yml +++ b/roles/systemd_networkd/tasks/main.yml @@ -15,11 +15,20 @@ - ansible_facts.distribution | lower == 'debian' - ansible_facts.distribution_major_version >= '12' -- name: Enable systemd-networkd - become: true - ansible.builtin.service: - name: systemd-networkd - enabled: true +- block: + # TODO(mattcrees): Remove once this gets into a versioned release: + # https://github.com/ansible/ansible/pull/77754 + - name: Temporarily disable systemd-networkd + become: true + service: + name: systemd-networkd + enabled: no + + - name: enable systemd-networkd + become: true + service: + name: systemd-networkd + enabled: yes when: systemd_networkd_network or systemd_networkd_link or systemd_networkd_netdev - name: Start and enable systemd-resolved