mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make parameterized playbook includes work with vars as a list
Fixes #1610.
This commit is contained in:
parent
5752d2a850
commit
eebbbd3f0e
3 changed files with 12 additions and 2 deletions
|
@ -166,7 +166,10 @@ class PlayBook(object):
|
||||||
for p in plays:
|
for p in plays:
|
||||||
if 'vars' not in p:
|
if 'vars' not in p:
|
||||||
p['vars'] = {}
|
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)
|
accumulated_plays.extend(plays)
|
||||||
play_basedirs.extend(basedirs)
|
play_basedirs.extend(basedirs)
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ class TestPlaybook(unittest.TestCase):
|
||||||
"localhost": {
|
"localhost": {
|
||||||
"changed": 0,
|
"changed": 0,
|
||||||
"failures": 0,
|
"failures": 0,
|
||||||
"ok": 5,
|
"ok": 10,
|
||||||
"skipped": 0,
|
"skipped": 0,
|
||||||
"unreachable": 0
|
"unreachable": 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,10 @@
|
||||||
gather_facts: False
|
gather_facts: False
|
||||||
tasks:
|
tasks:
|
||||||
- action: debug msg="$variable"
|
- action: debug msg="$variable"
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
- ugly: var
|
||||||
|
gather_facts: False
|
||||||
|
tasks:
|
||||||
|
- action: debug msg="$variable"
|
||||||
|
|
Loading…
Reference in a new issue