refactor ♻️: Refactor task parsing logic
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 10s
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 10s
Updated the task parsing algorithm to handle WOL support and state more robustly, ensuring accurate task management.
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
msg: >
|
msg: >
|
||||||
{{ wol_check.results | map(attribute='stdout_lines') | list }}
|
{{ wol_check.results | map(attribute='stdout_lines') | list }}
|
||||||
|
|
||||||
- name: Parse WOL support and state
|
- name: Parse WOL support and state (robust)
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
wol_info: >-
|
wol_info: >-
|
||||||
{{
|
{{
|
||||||
@@ -55,9 +55,10 @@
|
|||||||
(
|
(
|
||||||
item.stdout_lines
|
item.stdout_lines
|
||||||
| select('search', '^\\s*Supports Wake-on:')
|
| select('search', '^\\s*Supports Wake-on:')
|
||||||
| join(' ')
|
| map('regex_replace', '^\\s*Supports Wake-on:\\s*', '')
|
||||||
| regex_search('g')
|
| first
|
||||||
) is not none,
|
| default('')
|
||||||
|
).find('g') != -1,
|
||||||
'current_state':
|
'current_state':
|
||||||
(
|
(
|
||||||
item.stdout_lines
|
item.stdout_lines
|
||||||
|
|||||||
Reference in New Issue
Block a user