refactor ♻️: Remove commented-out debug tasks and update Wake-on-LAN condition
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
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.
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user