refactor ♻️: Refactor task to dynamically detect physical NIC backing a bridge, excluding tap and fw interfaces.
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.
This commit is contained in:
@@ -14,15 +14,16 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Detect physical NIC backing vmbr0
|
- name: "Detect physical NIC backing {{ wol_bridge }}"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
wol_detected_phy: >-
|
wol_detected_phy: >-
|
||||||
{{
|
{{
|
||||||
bridge_links.stdout_lines
|
bridge_links.stdout_lines
|
||||||
| select('search', wol_bridge)
|
|
||||||
| select('search', 'master ' ~ wol_bridge)
|
| select('search', 'master ' ~ wol_bridge)
|
||||||
| map('regex_search', '^\\d+: ([^:@]+)', '\\1')
|
| map('regex_replace', '^\\d+: ([^:@]+).*', '\\1')
|
||||||
| select('string')
|
| reject('search', '^tap')
|
||||||
|
| reject('search', '^fw')
|
||||||
|
| reject('equalto', '')
|
||||||
| first
|
| first
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user