1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Supported 'listed' vars in playbooks.

This commit is contained in:
Jeroen Hoekx 2012-04-19 08:49:09 +02:00
parent 903e4f6eae
commit cdb8213dcc

View file

@ -118,8 +118,18 @@ class PlayBook(object):
if play.get('vars') is None:
play['vars'] = {}
vars = play['vars']
if type(vars) != dict:
if type(vars) not in [dict, list]:
raise errors.AnsibleError("'vars' section must contain only key/value pairs")
# translate a list of vars into a dict
if type(vars) == list:
varlist = vars
vars = {}
for item in varlist:
k, v = item.items()[0]
vars[k] = v
play['vars'] = vars
vars_prompt = play.get('vars_prompt', {})
if type(vars_prompt) != dict:
raise errors.AnsibleError("'vars_prompt' section must contain only key/value pairs")