refactor ♻️: Refactor task handling to use en_interfaces and add non-empty list condition
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
This commit refactors the task handling logic to utilize the `en_interfaces` module and includes a conditional check for non-empty lists, enhancing code readability and functionality.
This commit is contained in:
@@ -60,9 +60,10 @@
|
|||||||
|
|
||||||
- name: Check supported Wake-on-LAN modes
|
- name: Check supported Wake-on-LAN modes
|
||||||
ansible.builtin.shell: "ethtool {{ item }} | grep 'Supports Wake-on' | tail -1 | awk '{print $3}'"
|
ansible.builtin.shell: "ethtool {{ item }} | grep 'Supports Wake-on' | tail -1 | awk '{print $3}'"
|
||||||
loop: "{{ interfaces }}"
|
loop: "{{ en_interfaces }}"
|
||||||
register: wol_supported
|
register: wol_supported
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when: en_interfaces | length > 0
|
||||||
|
|
||||||
- name: Display supported WoL modes
|
- name: Display supported WoL modes
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
|
|||||||
Reference in New Issue
Block a user