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
5020af0a
Commit
5020af0a
authored
Oct 22, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1404 from dagwieers/doc-fix1
Clarify how only_if works, also combined with with_items
parents
52f2ed5f
7d990fa1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
docsite/rst/playbooks2.rst
+12
-4
No files found.
docsite/rst/playbooks2.rst
View file @
5020af0a
...
...
@@ -272,12 +272,20 @@ In Ansible 0.8, a few shortcuts are available for testing whether a variable is
tasks:
- action: command echo hi
only_if: is_set(
$some_variable
)
only_if: is_set(
'$some_variable'
)
There is a matching 'is_unset' that works the same way.
Do not quote the variables inside the function
.
There is a matching 'is_unset' that works the same way.
Quoting the variable inside the function is mandatory
.
While only_if is a pretty good option for advanced users, it exposes more guts of the engine than we'd like, and
we can do better. In 0.9, we will be adding 'when', which will be like a syntactic sugar for only_if and hide
When combining `only_if` with `with_items`, be aware that the `only_if` statement is processed for each item.
This is a deliberate design::
tasks:
- action: command echo $item
with_item: [ 0, 2, 4, 6, 8, 10 ]
only_if: "$item > 5"
While `only_if` is a pretty good option for advanced users, it exposes more guts of the engine than we'd like, and
we can do better. In 0.9, we will be adding `when`, which will be like a syntactic sugar for `only_if` and hide
this level of complexity -- it will numerous built in operators.
Conditional Imports
...
...
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