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
906746b1
Commit
906746b1
authored
Jul 07, 2013
by
Stoned Elipot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Jinja2 filter 'skipped' to test for a registered variable from a skipped task
parent
b2d881a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
docsite/latest/rst/playbooks2.rst
+2
-0
lib/ansible/runner/filter_plugins/core.py
+10
-0
No files found.
docsite/latest/rst/playbooks2.rst
View file @
906746b1
...
...
@@ -300,6 +300,8 @@ decide to do something conditionally based on success or failure::
when: result|failed
- action: command /bin/something_else
when: result|success
- action: command /bin/still/something_else
when: result|skipped
As a reminder, to see what derived variables are available, you can do::
...
...
lib/ansible/runner/filter_plugins/core.py
View file @
906746b1
...
...
@@ -44,6 +44,13 @@ def failed(*a, **kw):
def
success
(
*
a
,
**
kw
):
return
not
failed
(
*
a
,
**
kw
)
def
skipped
(
*
a
,
**
kw
):
item
=
a
[
0
]
if
type
(
item
)
!=
dict
:
raise
errors
.
AnsibleError
(
"|skipped expects a dictionary"
)
skipped
=
item
.
get
(
'skipped'
,
False
)
return
skipped
def
mandatory
(
a
):
''' Make a variable mandatory '''
if
not
a
:
...
...
@@ -88,6 +95,9 @@ class FilterModule(object):
'failed'
:
failed
,
'success'
:
success
,
# skip testing
'skipped'
:
skipped
,
# variable existence
'mandatory'
:
mandatory
,
...
...
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