I am trying to perform a failed_when: on an async task based on a value
from stdout.
This is my task:
- name: RUN SOME TASK LOCALLY
command: <run_some_script_here>.sh
chdir=/task_folder/
delegate_to: localhost
register: task_status
async: 3600
poll: 0
This is where I check on the task status and would like it to fail when the
specified text is in stdout.
- name: CHECK TASK PROGRESS
async_status: jid={{ task_status.ansible_job_id }}
register: poll_status
until: poll_status.finished
retries: 100
failed_when: "'ERROR. TASK FAILED.' in poll_status.stdout"
When I run the above playbook I am faced with the following error from
Ansible
TASK [CHECK TASK PROGRESS]
*************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional
check ''ERROR. TASK FAILED.' in poll_status.stdout' failed. The error was:
error while evaluating conditional ('ERROR. TASK FAILED.' in
poll_status.stdout): Unable to look up a name or access an attribute in
template string ({% if 'ERROR. TASK FAILED.' in poll_status.stdout %} True
{% else %} False {% endif %}).\nMake sure your variable name does not
contain invalid characters like '-': argument of type 'StrictUndefined' is
not iterable"}
Help! Thanks in advance.
--
This communication contains information which is confidential and the
copyright of Whispir or a third party. If you have received this email in
error please notify us by return email or telephone Whispir on +613 8630
9900 and delete the document and delete all copies immediately. If you are
the intended recipient of this communication you should not copy, disclose
or distribute this communication without the authority of Whispir. Any
views expressed in this Communication are those of the individual sender,
except where the sender specifically states them to be the views of
Whispir. Except as required at law, Whispir does not represent, warrant
and/or guarantee that the integrity of this communication has been
maintained nor that the communication is free of errors,virus, interception
or interference.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/43dff1e3-51e1-4b82-af5d-b1bc2b2967c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.