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
7f0e89a2
Commit
7f0e89a2
authored
Jun 01, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain when statements with |failure and |success.
parent
c4a125e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
docsite/latest/rst/playbooks2.rst
+14
-0
No files found.
docsite/latest/rst/playbooks2.rst
View file @
7f0e89a2
...
@@ -284,6 +284,20 @@ Don't panic -- it's actually pretty simple::
...
@@ -284,6 +284,20 @@ Don't panic -- it's actually pretty simple::
action: command /sbin/shutdown -t now
action: command /sbin/shutdown -t now
when: ansible_os_family == "Debian"
when: ansible_os_family == "Debian"
A number of Jinja2 "filters" can also be used in when statements, some of which are unique
and provided by ansible. Suppose we want to ignore the error of one statement and then
decide to do something conditionally based on success or failure::
tasks:
- action: command /bin/false
register: result
ignore_errors: True
- action: command /bin/something
when: result|failed
- action: command /bin/something_else
when: result|sucess
As a reminder, to see what derived variables are available, you can do::
As a reminder, to see what derived variables are available, you can do::
ansible hostname.example.com -m setup
ansible hostname.example.com -m setup
...
...
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