New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tags are ignored on plays that are included that use with_items #19115
Comments
Files identified in the description: If these files are inaccurate, please update the |
Files identified in the description: If these files are inaccurate, please update the |
Had a really near problem and reported it first on stack overflow. STEPS TO REPRODUCE role/tasks/main.yml
role/tasks/test.yml
When I run my playbook with
However, I got this output:
So the tasks are not being executed. WORKAROUND Put tags on each task of the included file: role/tasks/main.yml
role/tasks/test.yml
|
@jasonmichaellehman this issue is resolved in recent ansible versions, but will require a change from static includes cannot utilize host variables, such as from Changing to
If you have further questions please stop by IRC or the mailing list:
|
@sivel unfortunately, for my test case, this doesn't work either. I have the same output when using
|
@mickaelperrin your issue is different from the one described here. What you are encountering is expected, and explained at https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance A tag applied to a dynamic include only affects the include, and is not inherited by the tasks within. |
@sivel Thanks for taking time to answer me and to point me in the right direction. |
ISSUE TYPE
COMPONENT NAME
Conditional Include
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
RHEL 7
SUMMARY
TAGS are ignored when including a playbook that uses with_items
STEPS TO REPRODUCE
run ansible-playbook tagtest.yml --tags dev
tagtest.yml
tasks/foobar.yml
EXPECTED RESULTS
Expectation is that the first play on localhost with tags Prod would have been ignored and only "hello dev tags" would have been outputted.
ACTUAL RESULTS
The play attempted to run the include task and failed because it did NOT include the first set_fact and taskname was coming through as undefined. In prior version of ansible the complete host section would be skipped when tags were used in this fashion.
The text was updated successfully, but these errors were encountered: