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
YAML extra vars don't appear to work #46052
Comments
As of right now, to load extra vars as YAML via direct input, requires JSON-like markup. This would require you to utilize:
To indicate that this is YAML data. The process at this point is to:
It's possible that this could be changed to just try loading as YAML between 2 and 3 and gracefully fail. |
In this case, perhaps the docs should be adjusted to not show examples where yaml input is used without {} syntax for now? |
Came across this same situation. It looks like |
Thank you @sivel, I will adjust how I'm using --extra-vars. The below behavior (Results 3) had been haunting me for a while. Use the intersect filter with --extra-vars:
Results 1 - Works as expected:
Results 2 - Works as expected based on sivel's YAML formatting example above:
Results 3 - Fails as 'grape' was incorrectly include with results:
|
We should update docs to indicate that simple YAML can be used on the CLI. For more advanced things, a file should be used. |
@relrod @sivel I think this is already mentioned Defining variables at runtime. So can we close this issue? |
looks like it, thanks! |
SUMMARY
When specifying extra vars in yaml format, they remain undefined
ISSUE TYPE
COMPONENT NAME
core
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Debian Testing
STEPS TO REPRODUCE
Run below playbook with
ansible-playbook test.yml -e "test_var: hi"
Compare with
ansible-playbook test.yml -e "test_var=hi"
It's hard for me to believe this feature wouldn't work considering plenty of people are likely using it. However, this usage seems to be perfectly inline with the examples in the documentation.
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: