ansible/ansible — pull request #4219 by bennojoy (2013-09-24 10:22:42+00:00)
Title: do/until feature for tasks

This pull request enables a tasks to re-execute till a certain condition is met or the number of retries is finished.
The syntax for the task would be as follows:

- action: shell /usr/bin/foo
register: result
until: register.stdout.find("all systems go") != -1
retries: 5
delay: 10

The default values for "retries" is 3 and "delay" is 5. The task returns the results returned by the last task run. Though the results of individual runs can be viewed by -vv option.
A new return code "until_result" is also added, a 0 means that the task did not meet the "until" conditional and 1 denotes a successful "until" condition.