From c355935c9c94fc9376474f18780dbb4d81e1c09a Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Fri, 30 Apr 2021 13:50:24 +0100
Subject: [PATCH] Ubuntu: avoid shadowing of networkd config files

Kayobe removes any systemd-networkd configuration generated by netplan,
since it can shadow our own configuration. This is performed via a
handler, but in practice it may run after the handler that restarts
systemd-networkd. This can leave the system using the netplan
configuration, which might not be correct. For example, if the interface
should be a bridge port.

This change fixes the issue by flushing handlers before importing the
systemd-networkd role.

Change-Id: I62ef7746aca4c6889526692cd0897e422937e70e
Story: 2004960
Task: 42415
---
 ansible/roles/network-debian/tasks/main.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ansible/roles/network-debian/tasks/main.yml b/ansible/roles/network-debian/tasks/main.yml
index 22740e0f..e0f8ab77 100644
--- a/ansible/roles/network-debian/tasks/main.yml
+++ b/ansible/roles/network-debian/tasks/main.yml
@@ -23,6 +23,11 @@
   notify:
     - Remove netplan systemd-networkd configuration
 
+# NOTE(mgoddard): The above needs to fire before any restart of
+# systemd-networkd, to avoid shadowing of our configuration files by those
+# provided by netplan.
+- meta: flush_handlers
+
 - name: Configure systemd-networkd
   import_role:
     name: stackhpc.systemd_networkd
-- 
GitLab