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
7a485253
Commit
7a485253
authored
Nov 13, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1612 from dhozac/play-vars-list
Make parameterized playbook includes work with vars as a list
parents
e3f7f86a
eebbbd3f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
lib/ansible/playbook/__init__.py
+4
-1
test/TestPlayBook.py
+4
-2
test/playbook-included.yml
+7
-0
No files found.
lib/ansible/playbook/__init__.py
View file @
7a485253
...
...
@@ -166,7 +166,10 @@ class PlayBook(object):
for
p
in
plays
:
if
'vars'
not
in
p
:
p
[
'vars'
]
=
{}
p
[
'vars'
]
.
update
(
incvars
)
if
isinstance
(
p
[
'vars'
],
dict
):
p
[
'vars'
]
.
update
(
incvars
)
elif
isinstance
(
p
[
'vars'
],
list
):
p
[
'vars'
]
.
extend
([
dict
(
k
=
v
)
for
k
,
v
in
incvars
.
iteritems
()])
accumulated_plays
.
extend
(
plays
)
play_basedirs
.
extend
(
basedirs
)
...
...
test/TestPlayBook.py
View file @
7a485253
...
...
@@ -114,6 +114,7 @@ class TestPlaybook(unittest.TestCase):
def
_run
(
self
,
test_playbook
,
host_list
=
'test/ansible_hosts'
):
''' run a module and get the localhost results '''
# This ensures tests are independent of eachother
global
EVENTS
ansible
.
playbook
.
SETUP_CACHE
.
clear
()
EVENTS
=
[]
...
...
@@ -202,7 +203,8 @@ class TestPlaybook(unittest.TestCase):
assert
utils
.
jsonify
(
expected
,
format
=
True
)
==
utils
.
jsonify
(
actual
,
format
=
True
)
assert
len
(
EVENTS
)
==
60
print
"len(EVENTS) =
%
d"
%
len
(
EVENTS
)
assert
len
(
EVENTS
)
==
26
def
test_includes
(
self
):
pb
=
os
.
path
.
join
(
self
.
test_dir
,
'playbook-includer.yml'
)
...
...
@@ -215,7 +217,7 @@ class TestPlaybook(unittest.TestCase):
"localhost"
:
{
"changed"
:
0
,
"failures"
:
0
,
"ok"
:
5
,
"ok"
:
10
,
"skipped"
:
0
,
"unreachable"
:
0
}
...
...
test/playbook-included.yml
View file @
7a485253
...
...
@@ -3,3 +3,10 @@
gather_facts
:
False
tasks
:
-
action
:
debug msg="$variable"
-
hosts
:
all
vars
:
-
ugly
:
var
gather_facts
:
False
tasks
:
-
action
:
debug msg="$variable"
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