For example, if I want a task to pull ec2_instance_facts until any
instance is in running state, and retry if none is running.
---
- hosts: localhost
gather_facts: no
connection: local
tasks:
- name: get ec2_instance_facts
ec2_instance_facts:
register: my_ec2
until: item.state.name == 'running'
with_items: '{{ my_ec2.instances }}'
But I am getting error, because my_ec2 is not defined yet.
TASK [get ec2_instance_facts]
**********************************************************************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "'my_ec2' is
undefined"}
Is it possible to loop over the result and retry the task in a single
task? If I have to make a second task to loop over the result, I can't go
back to retry the first task. How does Ansible handle retry of multiple
tasks?
Thanks
--
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/fd013a66-ab84-467f-9d7e-d3819710cfd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.