-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: adapt role to deal with cloud-init/netplan
- Loading branch information
1 parent
72c2f77
commit 62421c3
Showing
3 changed files
with
87 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Net role | ||
|
||
(Re-)configures host networking using ifupdown, uptionally renaming interfaces | ||
based on MAC address. | ||
|
||
Note: this role disables cloud-init handling of network configuration. | ||
|
||
See /usr/share/doc/udev/README.Debian.gz for details on how interface renaming | ||
is handled. | ||
|
||
## Troubleshooting | ||
|
||
As distributions adopt "modern" automatic configuration tools things might | ||
break, in particular udev rules tend to get clobbered. | ||
|
||
These commands can help debug why the changes are not being applied: | ||
|
||
``` | ||
SYSTEMD_LOG_LEVEL=debug \ | ||
udevadm test-builtin net_setup_link /sys/class/net/<iface> | ||
``` | ||
|
||
``` | ||
SYSTEMD_LOG_LEVEL=debug \ | ||
udevadm test -a add /sys/class/net/<iface> | ||
``` | ||
|
||
Note: the `udevadm test` command seems to apply changes and not just test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# vim:ts=2:sw=2:et:ai:sts=2 | ||
--- | ||
- name: _tina_restart_udev | ||
ansible.builtin.service: | ||
name: udev | ||
state: restarted | ||
listen: _tina_restart_net_all | ||
|
||
- name: _tina_reconfigure_network | ||
ansible.builtin.shell: # noqa: risky-shell-pipe | ||
cmd: >- | ||
ifdown --all --force; | ||
for dev in `ip -o link show | sed -n 's/[0-9]*: \(\S\+\):.*/\1/p'`; do | ||
networkctl reload; | ||
ifdown --verbose --all --force; | ||
for dev in `ls /sys/class/net`; do | ||
ip link set dev $dev down; | ||
done; | ||
udevadm trigger -c add -s net; | ||
udevadm control --reload; | ||
udevadm trigger --action add --subsystem-match net; | ||
ip addr flush scope global; | ||
ifup --all --force; | ||
listen: _tina_restart_net_all | ||
ifup --verbose --all --force; | ||
changed_when: true | ||
|
||
- name: _tina_update_initramfs | ||
ansible.builtin.command: | ||
cmd: update-initramfs -u -k all | ||
changed_when: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters