From e38ae186278e955ad3e3ef7837953bc67707651a Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Tue, 3 Apr 2012 17:22:45 +0200 Subject: [PATCH] Always add vars to a play. A play without vars section would fail to use variables given in an include. They would be added to the dict returned by play.get, but the dict would not be added to the play. --- lib/ansible/playbook.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook.py b/lib/ansible/playbook.py index aa0e69b828..029f28c654 100755 --- a/lib/ansible/playbook.py +++ b/lib/ansible/playbook.py @@ -91,8 +91,9 @@ class PlayBook(object): def _get_vars(self, play, dirname): ''' load the vars section from a play ''' - - vars = play.get('vars', {}) + if play.get('vars') is None: + play['vars'] = {} + vars = play['vars'] if type(vars) != dict: raise errors.AnsibleError("'vars' section must contain only key/value pairs") vars_prompt = play.get('vars_prompt', {})