Closed pmarrone closed 7 years ago
@pmarrone
Thanks for using Ansible Container, and for taking the time to open an issue and share your feedback.
Agree that this looks like a bug. Will dig into it.
In the meantime, a possible workaround might be to use include_vars
within your role. Check out the Ansible docs here.
Might be related to this change: 497b7794
@pmarrone
Did some testing on this. I think the issue is the placement of template variables within the variable file. We don't perform interpolation on the variable file itself, and so Ansible Container's template resolution is not quite the same as that of Ansible Playbook.
It also seems that passing unicode literals as variable values works. Using unicode values does not seem to be an issue for Ansible Container, nor Ansible Playbook.
Closing for now. If you disagree, please comment, and we'll re-open.
Thanks!
ISSUE TYPE
container.yml
OS / ENVIRONMENT
SUMMARY
While migrating a playbook to ansible-container 0.9.1, I had to call my var files manually since there's no more main.yml file to reference them anymore. I used to call them like this in main.yml:
Now, following the docs, I'm tyring to run
ansible-container --var-file vars/user.yml build
Running ansible-container with
--var-file
seems to fail when yml file has non ascii characters in some cases. I get this:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 369: ordinal not in range(128)
This is not always the case, but it happened when there were non-ascii characters inside arrays, mixed with template variables. These are some of the smallest test var-files I could come up with I created an empty project with
ansible-container init
, created a vars.yml file and ran the following testsThis vars.yml file fails
This one also fails
sources: [ 'ñ', '{{ 1 }}']
This one also fails
But this works
And this works also
This one also works
The complete the error trace:
STEPS TO REPRODUCE
ansible-container
with the--var-file
parameter pointing to the created fileEXPECTED RESULTS
Ansible-container build process should launch normally
ACTUAL RESULTS
Debug output: