diff --git a/v2/ansible/playbook/taggable.py b/v2/ansible/playbook/taggable.py index 3622dc34b27..40e05d1817a 100644 --- a/v2/ansible/playbook/taggable.py +++ b/v2/ansible/playbook/taggable.py @@ -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__() diff --git a/v2/ansible/plugins/strategies/linear.py b/v2/ansible/plugins/strategies/linear.py index 9988bb3e2a3..95ecac1451f 100644 --- a/v2/ansible/plugins/strategies/linear.py +++ b/v2/ansible/plugins/strategies/linear.py @@ -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) diff --git a/v2/samples/hosts b/v2/samples/hosts new file mode 100644 index 00000000000..118379ffd9e --- /dev/null +++ b/v2/samples/hosts @@ -0,0 +1 @@ +testing ansible_connection=local ansible_ssh_host=192.168.122.100 ansible_ssh_user=testing diff --git a/v2/samples/include.yml b/v2/samples/include.yml index 3a2e88f8985..121c4ce0794 100644 --- a/v2/samples/include.yml +++ b/v2/samples/include.yml @@ -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}}"