diff --git a/tasks/main.yml b/tasks/main.yml index 55cb4cf..f81f7c8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -47,11 +47,6 @@ changed_when: false when: en_interfaces | length > 0 -# - name: Display supported WoL modes -# ansible.builtin.debug: -# msg: "Interface {{ item.item }} supports WoL modes: {{ item.stdout }}" -# loop: "{{ wol_supported.results }}" - - name: WOL | Check if enabled shell: > ethtool {{ item }} | grep 'Wake-on' | tail -1 | awk '{print substr($0,length,1)}' @@ -61,17 +56,11 @@ loop: "{{ en_interfaces }}" when: en_interfaces | length > 0 -# - name: Display WoL status -# ansible.builtin.debug: -# msg: "Interface {{ item.item }} WoL status: {{ item.stdout }}" -# loop: "{{ wol_enabled.results }}" - - - name: Enable Wake-on-LAN (magic packet) when supported ansible.builtin.command: "ethtool -s {{ item }} wol g" when: - - g not in wol_enabled.results.stdout - - g in wol_supported.results.stdout + - "'g' not in wol_enabled.results[loop.index0].stdout" + - "'g' in wol_supported.results[loop.index0].stdout" loop: "{{ en_interfaces }}"