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
Error in a skipped test because of a non-existing variable #15683
Comments
Possible MisunderstandingHi! Thanks very much for your submission to Ansible. It sincerely means a lot to us. We believe the ticket you have filed is being somewhat misunderstood, as one thing works a little differently than stated. Roles CANNOT be made conditional themselves, so the In the future, this might be a topic more well suited for the user list, which you can also post here if you'd like some more help with the above. Thank you once again for this and your interest in Ansible! |
I guess, i did not explain myself well enough. the problem is not the "when:" in the task, but that ansible reacts differently on this unknown variable "ansible_local.something". if i use the variable in the task like debug (in the message), no error occurs, BUT when using the same unknown variable in the "with_items" an error occurs within the same circumstances. ansible should either consistently throw an error in both cases or in none of them. i guess my example was not the best. in the role file only the second and third example are interesting. |
that is because So |
sorry for the noise. i thought it is a bug, because it used to work in ansible 1.9.x and it "feels" a bit odd :-) |
ISSUE TYPE
ANSIBLE VERSION
ubuntu 16.04 package:
ansible 2.0.0.2
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
CONFIGURATION
i don't know about any changes
OS / ENVIRONMENT
ubuntu 16.04
SUMMARY
when using an undefined variable in a skipped test, an error will occur when used in "with_items" only.
STEPS TO REPRODUCE
i have a playbook, which includes a role under certain circumstances. for this showcase, i put it to false. so basically this role nor any of its tasks should get executed. the problem is the "with_items" task, which seems to get evaluated even though the task is skipped.
PLAYBOOK:
ROLE
EXPECTED RESULTS
I would expect, that non of the roles or tasks gets executed or evaluated at all. so no error should occur, no matter if a variable exists or not.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: