diff --git a/tasks/main.yml b/tasks/main.yml index 7d8bff2..cce793d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,7 +44,7 @@ msg: > {{ 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: wol_info: >- {{ @@ -55,9 +55,10 @@ ( item.stdout_lines | select('search', '^\\s*Supports Wake-on:') - | join(' ') - | regex_search('g') - ) is not none, + | map('regex_replace', '^\\s*Supports Wake-on:\\s*', '') + | first + | default('') + ).find('g') != -1, 'current_state': ( item.stdout_lines