refactor ♻️: Refactor shell and debug tasks to use ansible.builtin modules
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
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:
@@ -41,7 +41,7 @@
|
|||||||
{{ en_interfaces }}
|
{{ en_interfaces }}
|
||||||
|
|
||||||
- name: Check WoL status with ethtool
|
- name: Check WoL status with ethtool
|
||||||
shell: "ethtool {{ item }} | grep 'Wake-on'"
|
ansible.builtin.shell: "ethtool {{ item }} | grep 'Wake-on'"
|
||||||
register: wol_status
|
register: wol_status
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
@@ -49,17 +49,17 @@
|
|||||||
when: en_interfaces | length > 0
|
when: en_interfaces | length > 0
|
||||||
|
|
||||||
- name: Display WoL status
|
- name: Display WoL status
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ item.item }}: {{ item.stdout | default('No output') }}"
|
msg: "{{ item.item }}:\n{{ item.stdout | default('No output') }}"
|
||||||
loop: "{{ wol_status.results }}"
|
loop: "{{ wol_status.results }}"
|
||||||
|
|
||||||
- name: Display WOL status summary
|
- name: Display WoL status summary
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >
|
msg: >
|
||||||
Interface {{ item.key }}:
|
Interface {{ item.item }}:
|
||||||
Supported={{ item.value.supports_magic }},
|
Supported={{ item.stdout | regex_search('Supports Wake-on: (.+)', '\\1') | default('unknown') }},
|
||||||
Current={{ item.value.current_state }}
|
Current={{ item.stdout | regex_search('Wake-on: (.+)', '\\1') | default('unknown') }}
|
||||||
loop: "{{ wol_info | dict2items }}"
|
loop: "{{ wol_status.results }}"
|
||||||
|
|
||||||
|
|
||||||
# - name: Enable Wake-on-LAN (magic packet) when supported
|
# - name: Enable Wake-on-LAN (magic packet) when supported
|
||||||
|
|||||||
Reference in New Issue
Block a user