Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
16d03204
Commit
16d03204
authored
Sep 25, 2013
by
Benno Joy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update playbooks2.rst
parent
daf2f491
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
docsite/latest/rst/playbooks2.rst
+20
-17
No files found.
docsite/latest/rst/playbooks2.rst
View file @
16d03204
...
...
@@ -461,17 +461,17 @@ from turning into arbitrary code with ugly nested ifs, conditionals, and so on -
in more streamlined & auditable configuration rules -- especially because there are a
minimum of decision points to track.
Do
/
Until
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
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
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.
...
...
@@ -479,16 +479,19 @@ been retried for 5 times with a delay of 10 seconds. The default value for "retr
The task returns the results returned by the last task run. The results of individual retries can be viewed by -vv option.
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:
.. 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.
Example::
- action: shell /usr/bin/foo
register: result
until: register.stdout.find("all systems go") != -1
retries: 5
delay: 10
failed_when: result.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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment