diff --git a/tasks/main.yml b/tasks/main.yml index 33d319d..8d2116e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,7 +56,7 @@ loop: "{{ en_interfaces }}" when: en_interfaces | length > 0 -- name: Set Wake-on-LAN +- name: "Set Wake-on-LAN to {{ wol_mode }}" ansible.builtin.command: "ethtool -s {{ item.0 }} wol {{ wol_mode }}" loop: "{{ en_interfaces | zip(wol_enabled.results, wol_supported.results) | list }}" loop_control: @@ -65,6 +65,15 @@ - wol_mode not in item.1.stdout - wol_mode in item.2.stdout +- name: "Disable Wake-on-LAN" + ansible.builtin.command: "ethtool -s {{ item.0 }} wol {{ wol_mode }}" + loop: "{{ en_interfaces | zip(wol_enabled.results, wol_supported.results) | list }}" + loop_control: + label: "{{ item.0 }}" + when: + - wol_mode == 'd' + - wol_mode not in item.1.stdout + # # ============================================================ # # Enable WOL immediately (only if needed)