mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
parent
7666bde666
commit
169d316704
4 changed files with 11 additions and 6 deletions
|
@ -51,6 +51,8 @@ class IncludedFile:
|
||||||
|
|
||||||
if res._task.action == 'include':
|
if res._task.action == 'include':
|
||||||
if res._task.loop:
|
if res._task.loop:
|
||||||
|
if 'results' not in res._result:
|
||||||
|
continue
|
||||||
include_results = res._result['results']
|
include_results = res._result['results']
|
||||||
else:
|
else:
|
||||||
include_results = [ res._result ]
|
include_results = [ res._result ]
|
||||||
|
@ -82,13 +84,13 @@ class IncludedFile:
|
||||||
|
|
||||||
task_vars = variable_manager.get_vars(loader=loader, play=iterator._play, host=res._host, task=original_task)
|
task_vars = variable_manager.get_vars(loader=loader, play=iterator._play, host=res._host, task=original_task)
|
||||||
#task_vars = tqm.add_tqm_variables(task_vars, play=iterator._play)
|
#task_vars = tqm.add_tqm_variables(task_vars, play=iterator._play)
|
||||||
templar = Templar(loader=loader, variables=task_vars)
|
|
||||||
|
|
||||||
include_variables = include_result.get('include_variables', dict())
|
include_variables = include_result.get('include_variables', dict())
|
||||||
if 'item' in include_result:
|
if 'item' in include_result:
|
||||||
include_variables['item'] = include_result['item']
|
include_variables['item'] = include_result['item']
|
||||||
task_vars['item'] = include_result['item']
|
task_vars['item'] = include_result['item']
|
||||||
|
|
||||||
|
templar = Templar(loader=loader, variables=task_vars)
|
||||||
include_file = templar.template(include_file)
|
include_file = templar.template(include_file)
|
||||||
inc_file = IncludedFile(include_file, include_variables, original_task)
|
inc_file = IncludedFile(include_file, include_variables, original_task)
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ class CallbackBase:
|
||||||
else:
|
else:
|
||||||
self.v2_playbook_item_on_ok(newres)
|
self.v2_playbook_item_on_ok(newres)
|
||||||
|
|
||||||
del result._result['results']
|
#del result._result['results']
|
||||||
|
|
||||||
def set_play_context(self, play_context):
|
def set_play_context(self, play_context):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -68,6 +68,7 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
if result._task.loop and 'results' in result._result:
|
if result._task.loop and 'results' in result._result:
|
||||||
self._process_items(result)
|
self._process_items(result)
|
||||||
|
else:
|
||||||
|
|
||||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result and result._task.action != 'include':
|
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result and result._task.action != 'include':
|
||||||
msg += " => %s" % self._dump_results(result._result)
|
msg += " => %s" % self._dump_results(result._result)
|
||||||
|
|
|
@ -412,7 +412,9 @@ class StrategyBase:
|
||||||
|
|
||||||
# set the vars for this task from those specified as params to the include
|
# set the vars for this task from those specified as params to the include
|
||||||
for b in block_list:
|
for b in block_list:
|
||||||
b.vars.update(included_file._args.copy())
|
temp_vars = b.vars.copy()
|
||||||
|
temp_vars.update(included_file._args.copy())
|
||||||
|
b.vars = temp_vars
|
||||||
|
|
||||||
return block_list
|
return block_list
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue