diff --git a/tasks/main.yml b/tasks/main.yml index 13bd15f..f5750ec 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,66 +31,17 @@ msg: > {{ en_interfaces }} -# # ============================================================ -# # Normalize and validate configuration -# # ============================================================ -# - name: Set WOL bridges list (handle string or list) -# ansible.builtin.set_fact: -# wol_bridges_list: "{{ wol_bridges if wol_bridges is iterable and wol_bridges is not string else [wol_bridges] }}" +- name: Validate WOL capability using ethtool for detected interfaces + ansible.builtin.command: "ethtool {{ en_interfaces }}" + register: wol_capabilities_check + changed_when: false + failed_when: false -# - name: Validate WOL bridges list is not empty -# ansible.builtin.assert: -# that: -# - wol_bridges_list | length > 0 -# fail_msg: "wol_bridges must contain at least one bridge interface" +- name: Display ethtool output for detected interfaces + ansible.builtin.debug: + msg: > + {{ wol_capabilities_check.stdout_lines }}" -# # ============================================================ -# # Detect physical NICs with WOL support using Ansible facts -# # ============================================================ -# - name: Gather network interface facts -# ansible.builtin.setup: -# gather_subset: -# - network -# when: ansible_facts.interfaces is not defined - -# - name: Get all physical network interfaces with WOL support -# ansible.builtin.set_fact: -# wol_capable_interfaces: >- -# {{ -# ansible_facts.interfaces -# | map('extract', hostvars[inventory_hostname]['ansible_' ~ item] | default({})) -# | selectattr('type', 'defined') -# | selectattr('type', 'equalto', 'ether') -# | selectattr('device', 'defined') -# | rejectattr('device', 'search', '^(veth|tap|fw|lo|docker|br)') -# | map(attribute='device') -# | list -# }} - -# - name: Validate WOL capability using ethtool for detected interfaces -# ansible.builtin.command: "ethtool {{ item }}" -# register: wol_capabilities_check -# changed_when: false -# failed_when: false -# loop: "{{ wol_capable_interfaces }}" -# loop_control: -# label: "{{ item }}" - -# - name: Filter interfaces that actually support WOL -# ansible.builtin.set_fact: -# wol_supported_interfaces: >- -# {{ -# wol_capabilities_check.results -# | selectattr('stdout', 'search', 'Supports Wake-on:.*[gGdDpPuU]') -# | map(attribute='item') -# | list -# }} - -# - name: Fail if no interfaces support WOL -# ansible.builtin.assert: -# that: -# - wol_supported_interfaces | length > 0 -# fail_msg: "No network interfaces found that support Wake-on-LAN. Check BIOS settings and NIC capabilities." # # ============================================================ # # Map bridges to physical NICs using Ansible facts