refactor ♻️: Refactor regex search to use regex_findall and add condition to check if stdout is defined
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 regex search functionality by replacing the existing method with `regex_findall`. Additionally, it adds a conditional check to ensure that `stdout` is defined before proceeding with the search operation.
This commit is contained in:
@@ -57,9 +57,11 @@
|
||||
ansible.builtin.debug:
|
||||
msg: >
|
||||
Interface {{ item.item }}:
|
||||
Supported={{ item.stdout | regex_search('Supports Wake-on: (.+)', '\\1') | default('unknown') }},
|
||||
Current={{ item.stdout | regex_search('Wake-on: (.+)', '\\1') | default('unknown') }}
|
||||
Supported={{ (item.stdout | regex_findall('Supports Wake-on: (.+)') | first) | default('unknown') }},
|
||||
Current={{ (item.stdout | regex_findall('Wake-on: (.+)') | first) | default('unknown') }}
|
||||
loop: "{{ wol_status.results }}"
|
||||
when: item.stdout is defined
|
||||
|
||||
|
||||
|
||||
# - name: Enable Wake-on-LAN (magic packet) when supported
|
||||
|
||||
Reference in New Issue
Block a user