refactor ♻️: Refactor shell and debug tasks to use ansible.builtin modules
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s

Updated the shell and debug tasks to utilize `ansible.builtin` modules, enhancing compatibility and improving code clarity.
This commit is contained in:
2025-12-26 07:07:30 +01:00
parent 7a4c9c1583
commit 5f34c4e959

View File

@@ -41,7 +41,7 @@
{{ en_interfaces }}
- name: Check WoL status with ethtool
shell: "ethtool {{ item }} | grep 'Wake-on'"
ansible.builtin.shell: "ethtool {{ item }} | grep 'Wake-on'"
register: wol_status
changed_when: false
failed_when: false
@@ -49,17 +49,17 @@
when: en_interfaces | length > 0
- name: Display WoL status
debug:
msg: "{{ item.item }}: {{ item.stdout | default('No output') }}"
ansible.builtin.debug:
msg: "{{ item.item }}:\n{{ item.stdout | default('No output') }}"
loop: "{{ wol_status.results }}"
- name: Display WOL status summary
- name: Display WoL status summary
ansible.builtin.debug:
msg: >
Interface {{ item.key }}:
Supported={{ item.value.supports_magic }},
Current={{ item.value.current_state }}
loop: "{{ wol_info | dict2items }}"
Interface {{ item.item }}:
Supported={{ item.stdout | regex_search('Supports Wake-on: (.+)', '\\1') | default('unknown') }},
Current={{ item.stdout | regex_search('Wake-on: (.+)', '\\1') | default('unknown') }}
loop: "{{ wol_status.results }}"
# - name: Enable Wake-on-LAN (magic packet) when supported