From daf2f49116dee61a6478fbee5254d0c6c6911600 Mon Sep 17 00:00:00 2001 From: bennojoy Date: Wed, 25 Sep 2013 10:22:51 +0530 Subject: [PATCH] doc update --- docsite/latest/rst/playbooks2.rst | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docsite/latest/rst/playbooks2.rst b/docsite/latest/rst/playbooks2.rst index 8557e1cf53..37e2c613ee 100644 --- a/docsite/latest/rst/playbooks2.rst +++ b/docsite/latest/rst/playbooks2.rst @@ -467,11 +467,11 @@ Do/Until Sometimes you would want to retry a task till a certain condition is met, In such conditions the Do/Until feature will help. Here's an example which show's the syntax to be applied for the task. - - action: shell /usr/bin/foo - register: result - until: register.stdout.find("all systems go") != -1 - retries: 5 - delay: 10 + - action: shell /usr/bin/foo + register: result + until: register.stdout.find("all systems go") != -1 + retries: 5 + delay: 10 The above example run the shell module recursively till the module's result has "all systems go" in it's stdout or the task has been retried for 5 times with a delay of 10 seconds. The default value for "retries" is 3 and "delay" is 5. @@ -480,12 +480,15 @@ The task returns the results returned by the last task run. The results of indiv The results will have a new key "attempts" which will have the number of the retries for the task. .. note:: - The Do/Until does not take decision on whether to fail or pass the play when the maximum retries are completed, the user can - can do that in the next task as follows: + The Do/Until does not take decision on whether to fail or pass the play when the maximum retries are completed, the user can + can do that in the next task as follows: - - name: fail the play - fail: msg=" This play fails as the foo exceeded maximum retries" - fail_when: register.attempts >= 5 + - action: shell /usr/bin/foo + register: result + until: register.stdout.find("all systems go") != -1 + retries: 5 + delay: 10 + failed_when: result.attempts == 5 Loops