Merge pull request #114 from jhoekx/module-vars

Introduce task local variables.
reviewable/pr18780/r1
Michael DeHaan 13 years ago
commit c13c71c7d2

@ -48,7 +48,7 @@ for x in items:
source = params['src'] source = params['src']
dest = params['dest'] dest = params['dest']
metadata = params.get('metadata', '/etc/ansible/setup') metadata = params.get('metadata', '/etc/ansible/setup')
module_vars = params.get('vars')
# raise an error if there is no template metadata # raise an error if there is no template metadata
if not os.path.exists(metadata): if not os.path.exists(metadata):
@ -71,6 +71,19 @@ except:
}) })
sys.exit(1) sys.exit(1)
if module_vars:
try:
f = open(module_vars)
vars = json.loads(f.read())
data.update(vars)
f.close()
except:
print json.dumps({
"failed" : 1,
"msg" : "Failed to parse/load %s." % module_vars
})
sys.exit(1)
if not os.path.exists(source): if not os.path.exists(source):
print json.dumps({ print json.dumps({
"failed" : 1, "failed" : 1,

Loading…
Cancel
Save