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
You may help ansible to avoid templating crash because of undefined variable.
Change fail_when:
like this:
failed_when: "poll_status.stdout is defined and 'ERROR' in poll_status.stdout"
If job is not finished by the first run of polling task, stdout
is not yet populated and thus undefined, causing templating engine to crash.