|
|
@ -84,10 +84,14 @@ class InventoryScript(object):
|
|
|
|
|
|
|
|
|
|
|
|
if not isinstance(data, dict):
|
|
|
|
if not isinstance(data, dict):
|
|
|
|
data = {'hosts': data}
|
|
|
|
data = {'hosts': data}
|
|
|
|
|
|
|
|
# is not those subkeys, then simplified syntax, host with vars
|
|
|
|
elif not any(k in data for k in ('hosts','vars')):
|
|
|
|
elif not any(k in data for k in ('hosts','vars')):
|
|
|
|
data = {'hosts': [group_name], 'vars': data}
|
|
|
|
data = {'hosts': [group_name], 'vars': data}
|
|
|
|
|
|
|
|
|
|
|
|
if 'hosts' in data:
|
|
|
|
if 'hosts' in data:
|
|
|
|
|
|
|
|
if not isinstance(data['hosts'], list):
|
|
|
|
|
|
|
|
raise errors.AnsibleError("You defined a group \"%s\" with bad "
|
|
|
|
|
|
|
|
"data for the host list:\n %s" % (group_name, data))
|
|
|
|
|
|
|
|
|
|
|
|
for hostname in data['hosts']:
|
|
|
|
for hostname in data['hosts']:
|
|
|
|
if not hostname in all_hosts:
|
|
|
|
if not hostname in all_hosts:
|
|
|
@ -96,6 +100,10 @@ class InventoryScript(object):
|
|
|
|
group.add_host(host)
|
|
|
|
group.add_host(host)
|
|
|
|
|
|
|
|
|
|
|
|
if 'vars' in data:
|
|
|
|
if 'vars' in data:
|
|
|
|
|
|
|
|
if not isinstance(data['vars'], dict):
|
|
|
|
|
|
|
|
raise errors.AnsibleError("You defined a group \"%s\" with bad "
|
|
|
|
|
|
|
|
"data for variables:\n %s" % (group_name, data))
|
|
|
|
|
|
|
|
|
|
|
|
for k, v in data['vars'].iteritems():
|
|
|
|
for k, v in data['vars'].iteritems():
|
|
|
|
if group.name == all.name:
|
|
|
|
if group.name == all.name:
|
|
|
|
all.set_variable(k, v)
|
|
|
|
all.set_variable(k, v)
|
|
|
|