Open jbrinksmeier opened 7 years ago
@jbrinksmeier
Thanks for using Ansible Container, and for taking the time to share your feedback.
We use Templar from Ansible to apply templates, see config.py.
I believe, and I could be wrong, that the true and false string values defined in Ansible are defined here: https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/action/set_fact.py#L48 There are only 4 values: 'true', 'false', 'yes', 'no'.
If you're proposing a change, I would say that Ansible Container should adopt Ansible's behavior, and only support the same 4 values.
actually, ansible 2.3 accepts string values, I may pass 'on' as well as 'true' and get the desired values in the resulting files. Maybe that changed in 2.4, don't know.
I think that we should at least be able to force a string value, using
my_var: !!str 'on'
for example as suggested here: https://github.com/ansible/ansible/issues/11905#issuecomment-287879064
I hit this issue as well. Ansible 2.7. my_var: on is converted during the playbook run to true.
When updated my_var: "on" variable is working as expected.
ISSUE TYPE
container.yml
OS / ENVIRONMENT
SUMMARY
I want to fill values to a container's file. The values are on/off as strings and get parsed to True/False when running the template task.
STEPS TO REPRODUCE
I setup a minimum reproducible example here: https://github.com/jbrinksmeier/ac-template-bug
EXPECTED RESULTS
Should echo on
ACTUAL RESULTS
Echos True