1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix issue where included blocks were not filtered on tags (v2)

This commit is contained in:
James Cammarata 2015-05-01 08:32:26 -05:00
parent 1c250ee4e7
commit 4e08064afa
4 changed files with 7 additions and 2 deletions

View file

@ -26,7 +26,7 @@ from ansible.template import Templar
class Taggable:
untagged = set(['untagged'])
_tags = FieldAttribute(isa='list', default=None)
_tags = FieldAttribute(isa='list', default=[])
def __init__(self):
super(Taggable, self).__init__()

View file

@ -285,7 +285,9 @@ class StrategyModule(StrategyBase):
noop_block.rescue = [noop_task for t in new_block.rescue]
for host in hosts_left:
if host in included_file._hosts:
all_blocks[host].append(new_block)
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=included_file._task)
final_block = new_block.filter_tagged_tasks(connection_info, task_vars)
all_blocks[host].append(final_block)
else:
all_blocks[host].append(noop_block)

1
v2/samples/hosts Normal file
View file

@ -0,0 +1 @@
testing ansible_connection=local ansible_ssh_host=192.168.122.100 ansible_ssh_user=testing

View file

@ -1,4 +1,6 @@
- debug: msg="this is the include, a=={{a}}"
tags:
- included
#- debug: msg="this is the second debug in the include"
#- debug: msg="this is the third debug in the include, and a is still {{a}}"