allow include_vars to namespace imports
This commit is contained in:
parent
3d7f43982a
commit
7fdbfd490e
1 changed files with 11 additions and 1 deletions
|
@ -26,13 +26,19 @@ class ActionModule(ActionBase):
|
|||
TRANSFERS_FILES = False
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
|
||||
varname = self._task.args.get('name')
|
||||
source = self._task.args.get('file')
|
||||
if not source:
|
||||
source = self._task.args.get('_raw_params')
|
||||
|
||||
if task_vars is None:
|
||||
task_vars = dict()
|
||||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
try:
|
||||
source = self._find_needle('vars', self._task.args.get('_raw_params'))
|
||||
source = self._find_needle('vars', source)
|
||||
except AnsibleError as e:
|
||||
result['failed'] = True
|
||||
result['message'] = to_str(e)
|
||||
|
@ -46,6 +52,10 @@ class ActionModule(ActionBase):
|
|||
result['failed'] = True
|
||||
result['message'] = "%s must be stored as a dictionary/hash" % source
|
||||
else:
|
||||
if varname:
|
||||
scope = {}
|
||||
scope[varname] = data
|
||||
data = scope
|
||||
result['ansible_facts'] = data
|
||||
result['_ansible_no_log'] = not show_content
|
||||
|
||||
|
|
Loading…
Reference in a new issue