From 494f0b58b2d53f3a6790bd8ea2c0e774ebf00055 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Sat, 21 Feb 2026 07:56:21 +0100 Subject: [PATCH] fix(configuration): omit interface-name when not explicitly provided to avoid predictable naming mismatch --- roles/configuration/tasks/network_nm.yml | 7 +------ roles/configuration/templates/network.j2 | 3 +++ roles/global_defaults/tasks/_normalize_system.yml | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/roles/configuration/tasks/network_nm.yml b/roles/configuration/tasks/network_nm.yml index f2d8667..8be9b5f 100644 --- a/roles/configuration/tasks/network_nm.yml +++ b/roles/configuration/tasks/network_nm.yml @@ -2,12 +2,7 @@ - name: Copy NetworkManager keyfile per interface vars: configuration_iface: "{{ item }}" - configuration_iface_name: >- - {{ - item.name - if (item.name | default('') | string | length) > 0 - else (configuration_detected_interfaces[idx] | default('eth' ~ idx)) - }} + configuration_iface_name: "{{ item.name | default('') }}" configuration_net_uuid: "{{ ('LAN-' ~ idx ~ '-' ~ hostname) | ansible.builtin.to_uuid }}" ansible.builtin.template: src: network.j2 diff --git a/roles/configuration/templates/network.j2 b/roles/configuration/templates/network.j2 index e4c75e6..cbbd066 100644 --- a/roles/configuration/templates/network.j2 +++ b/roles/configuration/templates/network.j2 @@ -2,7 +2,10 @@ id=LAN-{{ idx }} uuid={{ configuration_net_uuid }} type=ethernet +autoconnect-priority=10 +{% if configuration_iface_name | length > 0 %} interface-name={{ configuration_iface_name }} +{% endif %} [ipv4] {% set iface = configuration_iface %} diff --git a/roles/global_defaults/tasks/_normalize_system.yml b/roles/global_defaults/tasks/_normalize_system.yml index f259bd6..cda5a71 100644 --- a/roles/global_defaults/tasks/_normalize_system.yml +++ b/roles/global_defaults/tasks/_normalize_system.yml @@ -41,7 +41,7 @@ if (system_raw.network.interfaces | default([]) | length > 0) else ( [{ - 'name': 'eth0', + 'name': '', 'bridge': system_raw.network.bridge | default('') | string, 'vlan': system_raw.network.vlan | default('') | string, 'ip': system_raw.network.ip | default('') | string,