diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index f26715dd93..ba3e7418ae 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -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) diff --git a/test/TestPlayBook.py b/test/TestPlayBook.py index 9ff679973d..d67779b673 100644 --- a/test/TestPlayBook.py +++ b/test/TestPlayBook.py @@ -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 } diff --git a/test/playbook-included.yml b/test/playbook-included.yml index 4f96e30a4a..d6cb3530a1 100644 --- a/test/playbook-included.yml +++ b/test/playbook-included.yml @@ -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"