From 908571b92d40baa9e16e7466f9604a84e9689d84 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 23 Dec 2025 20:52:54 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor=20tas?= =?UTF-8?q?k=20to=20dynamically=20detect=20physical=20NIC=20backing=20a=20?= =?UTF-8?q?bridge,=20excluding=20tap=20and=20fw=20interfaces.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactoring updates the task logic to dynamically identify the physical network interface card (NIC) backing a bridge, while excluding interfaces of types tap and fw. This change enhances the flexibility and accuracy of network configuration detection. --- tasks/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 59015e7..b9a9379 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,15 +14,16 @@ changed_when: false failed_when: false -- name: Detect physical NIC backing vmbr0 +- name: "Detect physical NIC backing {{ wol_bridge }}" ansible.builtin.set_fact: wol_detected_phy: >- {{ bridge_links.stdout_lines - | select('search', wol_bridge) | select('search', 'master ' ~ wol_bridge) - | map('regex_search', '^\\d+: ([^:@]+)', '\\1') - | select('string') + | map('regex_replace', '^\\d+: ([^:@]+).*', '\\1') + | reject('search', '^tap') + | reject('search', '^fw') + | reject('equalto', '') | first }}