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
include_role overrides variables from previous role #36274
Comments
@clvx Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. Here are the items we could not find in your description:
Please set the description of this issue with this template: |
pinging @bcoca |
@clvx Was this working prior to version 2.4.2.0 ? |
@alikins I've only tested it with ansible 2.4.2. I haven't verifeid with older ansible versions. |
I came across the same issue (ansible 2.7.6) ...
As you already pointed out in your example, defining the variable in the defaults file won't work. You need to use |
Defaults in one role do not automatically transfer to roles via include_role, and applying things correctly can lead to recursion issues: ansible/ansible#36274 Just set the default in the job. Change-Id: Iabefd80c8fc40a61a601b082f265c93af643cd83
It looks like this is not a roles variable scoping issue, so #69040 will not fix it. This happens since Ansible uses lazy evaluation for variables and |
ISSUE TYPE
container.yml
COMPONENT NAME
lib/ansible/modules/utilties/logic/include_role.py
ANSIBLE VERSION
OS / ENVIRONMENT
SUMMARY
include_role doesn't reads variables from role
dummy1
instead ofdummy2
. In this caserole_location
is defined indummy1
but not indummy2
.STEPS TO REPRODUCE
EXPECTED RESULTS
Success.
roles/dummy1/files/foo.conf
should be deployed withecho foo
.ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: