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 d66d56a417..d67779b673 100644 --- a/test/TestPlayBook.py +++ b/test/TestPlayBook.py @@ -217,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"