[systemd-devel] networkd: removing netdev files
yves baumes
ybaumes at gmail.com
Mon Mar 14 10:40:02 UTC 2022
Hello,
We are generating interfaces, vlan and bridges (.netdev and .network
files) via ansible, and we push them to a remote machine.
Then ansible is ordered to restart systemd-networkd when files have
been changed, or added, or removed.
We realize that if we remove a file corresponding to a vlan, then the
vlan will still exist on the remote machine, even though we restarted
systemd-networkd. It looks like it is stated in the documentation:
"When systemd-networkd exits, it generally leaves existing network
devices and configuration intact. This makes it possible to transition
from the initramfs and to restart the service without breaking
connectivity. This also means that when configuration is updated and
systemd-networkd is restarted, netdev interfaces for which
configuration was removed will not be dropped, and may need to be
cleaned up manually"
It is a little bit annoying. Do you know any workaround for this kind
of issue? I am trying to automate the process through ansible, so do
you think it is possible to ask ansible to remove every
interfaces/vlans/bridges on the machine (using 'ip link' tools), then
restart systemd-networkd (thus re-creating only what is listed in the
files), in order to have a state that mirrors what is in the files?
Or do you have a better solution in mind?
Restarting the whole device would do the trick as well, but this
solution is to be avoided: because it takes too much time.
Regards,
Yves
More information about the systemd-devel
mailing list