-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
variable conflict with 'role_name' value #6800
Comments
Can you please share a minimal example? It sounds like you defined a variable named 'role_name', in which case this is reserved, and you shouldn't do this. I would agree it might be nice that there is a warning about reserved variables, and there's a ticket open about this one. Let us know. |
In play.py (in versions 1.5.3 and 1.4.5): In version 1.4.5: In version 1.5.3: The second x clobbers the first, as it is inside the loop. This results in a TypeError, because the inner line attempts to reference x as a dictionary, but x has been assigned a a string key from data at that point. I haven't quite been able to figure out what is being assigned where, yet |
Ok, I took a stab at making a fairly simple example. You can create an inventory any test machine, and point this playbook at it. https://github.com/qkslvrwolf/ansible_roles You'll need ansible_error_test, level_1_role, level_2_role, and l2_includes_role. Just change the role in the error.yml playbook depending on what you want to try. The level_1_role works, the level_2_role gives you on error (that clearly demostrates that x was overridden incorrectly), and and l2_includes show what happens when you have both role dependency and includes in a task main.yml There's another little oddity. We have And items is never referenced between it assigning to a list with a single empty string and being used in a for loop. |
The above patch should fix this issue, and will be included in the next major release. If you continue to have any problems regarding this issue, please let us know. Regarding the "for item in items" issue, it does appear that the loop will only ever execute once, so could probably be removed. If you'd like to open a separate issue for that, please feel free to do so. Thanks! |
Issue Type:
Bug Report
Ansible Version:
1.4.5
1.5.3
Environment:
ubuntu 10.04, python 2.6.
Ansible installed via rquillo ppa
Ansible installed via git clone+hacking/setup.env
Summary:
double variable usage in play.py, with one clobbering the other
Steps To Reproduce:
Relevant roles here:
https://github.com/qkslvrwolf/ansible_roles
stack trace and error description here: http://pastebin.com/Vi1ujErt
snippet calling roles:
Expected Results:
The role will run
Actual Results:
The text was updated successfully, but these errors were encountered: