I have an ansible playbook which moves .network
and .netdev
files to the /etc/systemd/network/
directory. Theses files are generated automatically and I can't know their names or the name/number of the interfaces that will be (automatically) created.
The .network
and .netdev
contains the name of the interfaces that are created :
00-wg0.netdev
00-wg0.network
10-wg1.netdev
10-wg1.network
20-wg2.netdev
20-wg2.network
[...]
How can I (using ansible) :
- Get a list of the interfaces names like
wg0
orwg1
... using the files which are located in/etc/systemd/network/
? - Restart the interfaces (set them down, then up) using this list ?
Thanks
setup
module. There should be a fact calledansible_interfaces
listing the available interfaces..network
and.netdev
the interfaces doesn't exists yet so I can't know their names except in the files name. Furthermore, I would like to avoid restarting systemd because this would break the SSH connection (I think)