From 00bc5982857282d3fe3f80651344e19c61a918f4 Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 26 Dec 2025 09:13:34 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Remove=20comme?= =?UTF-8?q?nted-out=20debug=20tasks=20and=20update=20Wake-on-LAN=20conditi?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored the code by removing unused commented-out debug tasks and updated the condition for enabling Wake-on-LAN feature to improve performance and reduce unnecessary operations. --- tasks/main.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) 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 }}"