mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 01:44:03 -07:00
Fix tag filtering on included files and add more debugging
Previously, we were filtering the task list on tags for each host that was including the file, based on the idea that the variables had to include the host information. However, the top level task filtering is play-context only, which should also apply to the included tasks. Tags cannot and should not be based on hostvars.
This commit is contained in:
parent
5cbeab5a3c
commit
984729016e
4 changed files with 41 additions and 10 deletions
|
@ -156,13 +156,18 @@ class StrategyModule(StrategyBase):
|
|||
display.warning(str(e))
|
||||
continue
|
||||
|
||||
for host in hosts_left:
|
||||
if host in included_file._hosts:
|
||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=included_file._task)
|
||||
final_blocks = []
|
||||
for new_block in new_blocks:
|
||||
final_blocks.append(new_block.filter_tagged_tasks(play_context, task_vars))
|
||||
iterator.add_tasks(host, final_blocks)
|
||||
display.debug("generating all_blocks data")
|
||||
all_blocks = dict((host, []) for host in hosts_left)
|
||||
display.debug("done generating all_blocks data")
|
||||
for new_block in new_blocks:
|
||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, task=included_file._task)
|
||||
final_block = new_block.filter_tagged_tasks(play_context, task_vars)
|
||||
for host in hosts_left:
|
||||
if host in included_file._hosts:
|
||||
all_blocks[host].append(final_block)
|
||||
|
||||
for host in hosts_left:
|
||||
iterator.add_tasks(host, all_blocks[host])
|
||||
|
||||
# pause briefly so we don't spin lock
|
||||
time.sleep(0.05)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue