I am trying to use ansible loop until the condition is met.
I can use until
if the output is only single line, however if the output is multiple lines, I will need to use stdout_lines
but fail to do so.
If output is single line:
- name: check on sync status
shell: some command
register: sync_status
until: sync_status.stdout == 'SSUS'
If output is multiple lines, then I try to use stdout_lines
- name: check on sync status
shell: some command
register: sync_status
until: item.stdout_lines == 'SSUS'
with_items: "{{ sync_status }}"
but I got variable undefined:
fatal: [xxxxxxx]: FAILED! => {
"msg": "'sync_status' is undefined"
}
I don't want to do it on seperate task because then the sync_status is registered on previous task , and I will be comparing the old status instead of the current status.
Kindly assist.