inconsistent documentation for tags on dynamic-include tasks #34974
Labels
affects_2.4
This issue/PR affects Ansible v2.4
bug
This issue/PR relates to a bug.
include_role
module
This issue/PR relates to a module.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
utilities
Utilities category
Projects
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
Fedora 26 (probably N/A)
SUMMARY
The Creating Reusable Playbooks doc states:
The Tags doc, under Tag Inheritance states:
Documentation discrepancy
include_*
task should only determine whether theinclude_*
task itself is executed, and the tags should not propagate into the included role.include_*
orimport_*
are inherited by each task within the role.Personal opinion
The behavior described in "Creating Reusable Playbooks" seems most desirable. Actual behavior (described below) seems to be a combination of the two, and it doesn't offer much flexibility over the previous
include
functionality. This makes it impossible to run a subset of included tasks with a simple--tag
, and instead requires a much more complicated combination of--tag
+--skip-tags
.STEPS TO REPRODUCE
site.yml:
roles/role1/tasks/main.yml:
tasks.yml:
hosts:
EXPECTED RESULTS
Summary
Detail
ansible-playbook site.yml -i hosts -t role1
i. role1 should run only the tasks tagged:
always
,role1
ii. tasks.yml should be skipped
ansible-playbook site.yml -i hosts -t include-role
i. role1 should run only the task tagged:
always
ii. tasks.yml should be skipped
ansible-playbook site.yml -i hosts -t include-role,tag1
i. role1 should run only the tasks tagged:
always
,tag1
ii. tasks.yml should be skipped
ansible-playbook site.yml -i hosts -t include-tasks
i. role1 should be skipped
ii. tasks.yml should run only the tasks tagged:
always
ansible-playbook site.yml -i hosts -t include-tasks,tag1
i. role1 should be skipped
ii. tasks.yml should run only the tasks tagged:
always
,tag1
ansible-playbook site.yml -i hosts -t tag1
i. role1 should be skipped
ii. tasks.yml should be skipped
ACTUAL RESULTS
Summary
Detail
ansible-playbook site.yml -i hosts -t role1
i. (fail) role1 ran all tasks, including
tag1
ii. (pass) tasks.yml was skipped
ansible-playbook site.yml -i hosts -t include-role
i. (fail) role1 ran all tasks, including
role
,tag1
ii. (pass) tasks.yml was skipped
ansible-playbook site.yml -i hosts -t include-role,tag1
i. (fail) role1 ran all tasks, including
role1
ii. (pass) tasks.yml was skipped
ansible-playbook site.yml -i hosts -t include-tasks
i. (pass) role1 was skipped
ii. (fail) tasks.yml ran all tasks, including
tasks1
,tag1
ansible-playbook site.yml -i hosts -t include-tasks,tag1
i. (pass) role1 was skipped
ii. (fail) tasks.yml ran all tasks, including
tasks1
ansible-playbook site.yml -i hosts -t tag1
i. (pass) role1 was skipped
ii. (pass) tasks.yml was skipped
The text was updated successfully, but these errors were encountered: