proxmox: fix network interface renaming
Use systemd .link files which are "relatively futureproof" according to https://wiki.debian.org/NetworkInterfaceNames .
This commit is contained in:
parent
59c1431f93
commit
e499bbf570
3 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
- name: update initramfs
|
||||||
|
command: update-initramfs -u -k all
|
||||||
|
when: "'handler' not in ansible_skip_tags"
|
||||||
|
|
||||||
- name: reboot
|
- name: reboot
|
||||||
reboot:
|
reboot:
|
||||||
when: "'handler' not in ansible_skip_tags"
|
when: "'handler' not in ansible_skip_tags"
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
- name: Add rules to rename network interfaces
|
- name: Add rules to rename network interfaces
|
||||||
template:
|
template:
|
||||||
dest: /etc/udev/rules.d/10-network.rules
|
dest: "/etc/systemd/network/10-{{ item.name }}.link"
|
||||||
src: 10-network.rules.j2
|
src: interface.link.j2
|
||||||
mode: 0644
|
mode: "0644"
|
||||||
notify: reboot
|
loop: "{{ interfaces | selectattr('mac_address') }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
||||||
|
notify:
|
||||||
|
- update initramfs # recommended by https://pve.proxmox.com/wiki/Network_Configuration
|
||||||
|
- reboot
|
||||||
|
|
||||||
- name: Set up bridges
|
- name: Set up bridges
|
||||||
template:
|
template:
|
||||||
|
|
5
templates/interface.link.j2
Normal file
5
templates/interface.link.j2
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[Match]
|
||||||
|
MACAddress={{ item.mac_address | lower }}
|
||||||
|
|
||||||
|
[Link]
|
||||||
|
Name={{ item.name }}
|
Loading…
Add table
Add a link
Reference in a new issue