Fix issue where included blocks were not filtered on tags (v2)
This commit is contained in:
parent
1c250ee4e7
commit
4e08064afa
4 changed files with 7 additions and 2 deletions
|
@ -26,7 +26,7 @@ from ansible.template import Templar
|
||||||
class Taggable:
|
class Taggable:
|
||||||
|
|
||||||
untagged = set(['untagged'])
|
untagged = set(['untagged'])
|
||||||
_tags = FieldAttribute(isa='list', default=None)
|
_tags = FieldAttribute(isa='list', default=[])
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Taggable, self).__init__()
|
super(Taggable, self).__init__()
|
||||||
|
|
|
@ -285,7 +285,9 @@ class StrategyModule(StrategyBase):
|
||||||
noop_block.rescue = [noop_task for t in new_block.rescue]
|
noop_block.rescue = [noop_task for t in new_block.rescue]
|
||||||
for host in hosts_left:
|
for host in hosts_left:
|
||||||
if host in included_file._hosts:
|
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:
|
else:
|
||||||
all_blocks[host].append(noop_block)
|
all_blocks[host].append(noop_block)
|
||||||
|
|
||||||
|
|
1
v2/samples/hosts
Normal file
1
v2/samples/hosts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
testing ansible_connection=local ansible_ssh_host=192.168.122.100 ansible_ssh_user=testing
|
|
@ -1,4 +1,6 @@
|
||||||
- debug: msg="this is the include, a=={{a}}"
|
- 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 second debug in the include"
|
||||||
#- debug: msg="this is the third debug in the include, and a is still {{a}}"
|
#- debug: msg="this is the third debug in the include, and a is still {{a}}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue