From ea1f8f88d05544cc7baa4c2f51cf59f1f695a429 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 13 Aug 2025 12:03:28 +0200 Subject: [PATCH] proxmox: fix network interface renaming Use systemd .link files which are "relatively futureproof" according to https://wiki.debian.org/NetworkInterfaceNames . --- roles/proxmox/tasks/network.yml | 9 ++++++--- templates/interface.link.j2 | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 templates/interface.link.j2 diff --git a/roles/proxmox/tasks/network.yml b/roles/proxmox/tasks/network.yml index 0a1c2ac..75d0fae 100644 --- a/roles/proxmox/tasks/network.yml +++ b/roles/proxmox/tasks/network.yml @@ -1,8 +1,11 @@ - name: Add rules to rename network interfaces template: - dest: /etc/udev/rules.d/10-network.rules - src: 10-network.rules.j2 - mode: 0644 + dest: "/etc/systemd/network/10-{{ item.name }}.link" + src: interface.link.j2 + mode: "0644" + loop: "{{ interfaces | selectattr('mac_address') }}" + loop_control: + label: "{{ item.name }}" notify: reboot - name: Set up bridges diff --git a/templates/interface.link.j2 b/templates/interface.link.j2 new file mode 100644 index 0000000..9d58da8 --- /dev/null +++ b/templates/interface.link.j2 @@ -0,0 +1,5 @@ +[Match] +MACAddress={{ item.mac_address | lower }} + +[Link] +Name={{ item.name }}