refactor ♻️: Refactor task to detect physical NIC backing vmbr0 and update regex for extraction

This commit refactors the task logic to accurately detect the physical NIC backing vmbr0 and updates the regular expression used for extracting relevant information. This ensures more precise and reliable network configuration management.
This commit is contained in:
2025-12-23 21:31:41 +01:00
parent 3f61c1c48a
commit f087eaf5cd

View File

@@ -19,15 +19,16 @@
msg: "{{ bridge_links.stdout_lines }}"
- name: "Detect physical NIC backing {{ wol_bridge }}"
- name: Detect physical NIC backing vmbr0
ansible.builtin.set_fact:
wol_detected_phy_candidates: >-
{{
bridge_links.stdout_lines
| select('search', 'master ' ~ wol_bridge)
| map('regex_replace', '^\\d+: ([^:@]+).*', '\\1')
| map('regex_replace', '^\\d+: ([^:@]+):.*$', '\\1')
| reject('search', '^(veth|tap|fw)')
| list
}}
}}
- name: Select first physical NIC candidate
ansible.builtin.set_fact: