Unquoted "raw" Ansible variable in YAML output

Viewed 142

Given this template:

enabled: "{{ some_var }}"

And this variable definition:

some_var: true

How do I create a file from the template with the following output (notice there are no quotes):

enabled: true

Since curly braces must be quoted when they're at the beginning, currently I get enabled: "true". {{ some_var | bool }} also does not work.

1 Answers

Modify your template as below:

enabled: {{ some_var | string | lower }}
Related