refactor ♻️: Refactor task logic for detecting and reporting Wake-on-LAN interfaces, remove redundant debug tasks.
This commit refactors the task logic to improve the detection and reporting of Wake-on-LAN interfaces. It also removes redundant debug tasks to clean up the codebase.
This commit is contained in:
@@ -47,12 +47,12 @@
|
||||
{{
|
||||
wol_detected_interfaces | combine({
|
||||
item: (
|
||||
[
|
||||
line | regex_search('^\\d+: ([a-z0-9@.]+):', '\\1') | first
|
||||
for line in bridge_links.stdout_lines
|
||||
if ('master ' ~ item) in line
|
||||
and not line is search('^\\d+: (veth|tap|fw)')
|
||||
]
|
||||
bridge_links.stdout_lines
|
||||
| select('search', 'master ' ~ item)
|
||||
| map('regex_search', '^\\d+: ([a-z0-9@.]+):', '\\1')
|
||||
| map('first')
|
||||
| select('defined')
|
||||
| reject('search', '^(veth|tap|fw)')
|
||||
| first | default('')
|
||||
)
|
||||
})
|
||||
@@ -234,25 +234,3 @@
|
||||
- {{ iface }}: {{ mac | default('Unable to detect') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
when:
|
||||
- wol_report_mac
|
||||
- wol_mac_address | length == 0
|
||||
|
||||
- name: Show WOL status
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ wol_status.stdout_lines }}"
|
||||
when: wol_verify
|
||||
|
||||
- name: Report Wake-on-LAN sender details
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "Wake-on-LAN enabled successfully"
|
||||
- "Bridge: {{ wol_bridge }}"
|
||||
- "Physical NIC: {{ wol_detected_phy }}"
|
||||
- "MAC address: {{ wol_mac_address }}"
|
||||
- "Example commands:"
|
||||
- " wakeonlan {{ wol_mac_address }}"
|
||||
- " etherwake {{ wol_mac_address }}"
|
||||
- "Home Assistant:"
|
||||
- " mac: {{ wol_mac_address }}"
|
||||
when: wol_report_mac
|
||||
|
||||
Reference in New Issue
Block a user