From 7b4cb8f5792bb8e959c55e83b0c330a05b3bd56d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 26 Feb 2024 13:26:05 +0100 Subject: [PATCH] Add udev rules for renaming all interfaces with defined MAC address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gonna include BMC and such but shouldn’t hurt. Allows us to use different interface names where sensible. --- templates/10-network.rules.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/10-network.rules.j2 b/templates/10-network.rules.j2 index 604ca7b..cc0deff 100644 --- a/templates/10-network.rules.j2 +++ b/templates/10-network.rules.j2 @@ -1,3 +1,3 @@ -{% for iface in hostvars[inventory_hostname].interfaces | selectattr('name', 'match', '^(lan|mgmt)') %} +{% for iface in hostvars[inventory_hostname].interfaces | selectattr('mac_address') %} SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="{{ iface.mac_address|lower }}", NAME="{{ iface.name }}" {% endfor %}