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:
2025-12-23 22:19:24 +01:00
parent c4c786f19b
commit e9befb965d

View File

@@ -47,12 +47,12 @@
{{ {{
wol_detected_interfaces | combine({ wol_detected_interfaces | combine({
item: ( item: (
[ bridge_links.stdout_lines
line | regex_search('^\\d+: ([a-z0-9@.]+):', '\\1') | first | select('search', 'master ' ~ item)
for line in bridge_links.stdout_lines | map('regex_search', '^\\d+: ([a-z0-9@.]+):', '\\1')
if ('master ' ~ item) in line | map('first')
and not line is search('^\\d+: (veth|tap|fw)') | select('defined')
] | reject('search', '^(veth|tap|fw)')
| first | default('') | first | default('')
) )
}) })
@@ -234,25 +234,3 @@
- {{ iface }}: {{ mac | default('Unable to detect') }} - {{ iface }}: {{ mac | default('Unable to detect') }}
{% endfor %} {% endfor %}
{% endif %} {% 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