ansible playbook retry a task until success 20 April 2017
When writing ansible playbook, there is a scene when a task should be delayed for seconds to run. But you do not know how long it should be. In this case, we want to delay this task for seconds, and retry it for several times.
Here is an example to archive that.
tasks:
- shell: echo "do something"; exit 1
register: command_result
retries: 5
delay: 10
until: command_result | success
blog comments powered by Disqus