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
Modified "vars:" not visible inside include_role. #69799
Comments
Edit on GitHub fails: 404 |
@vbotka "Edit on GitHub fail" is known and reported here - #69683 (comment) |
for full fix #69040 |
Is (should be/will be) any difference between these options? - include_role:
name: test
tasks_from: task.yml
apply:
vars:
my_var: A and - include_role:
name: test
tasks_from: task.yml
vars:
my_var: A |
@vbotka mostly no, those should be almost the same, |
other possible fix #75287 |
Closing, since it looks like this was likely fixed awhile back. Feel free to reopen if this is still reproducible on currently-supported versions of Ansible Core. |
The problem, for your convenience also described here, is reproducible in 2.16.2 It seems, I can't reopen this issue. What do you mean by "Feel free to reopen" ? |
Just to confirm something here, the behavior questioned in this issue is expected. This is because See the following for the code definition of ansible/lib/ansible/playbook/task.py Lines 373 to 379 in 1b209d7
As a result, When using Based on this, it appears this is just a misunderstanding across multiple pieces of documentation. Perhaps the only thing we may be missing is a description of what |
Good to know.
... and this is known for two years. |
IMHO. Not included in https://github.com/ansible/ansible/projects/19
tested with ansible 2.9.6
SUMMARY
A modification of a variable declared in "vars" is not visible inside the included role.
ISSUE TYPE
COMPONENT NAME
include_role
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Linux host9 5.4.0-31-generic #35-Ubuntu SMP Thu May 7 20:20:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
STEPS TO REPRODUCE
Fresh role with this task only
EXPECTED RESULTS
Fix the documentation
ACTUAL RESULTS
Quoting from Examples
https://docs.ansible.com/ansible/latest/modules/include_role_module.html#examples
The text was updated successfully, but these errors were encountered: