I have some variables defined in a role such as:

---
# file: roles/consul/defaults/main.yml
consul_server: yes

And then I have a JSON template file with many settings for the software I 
am provisioning, but just for example:

{
  "server": {{ consul_server | bool }}
}


When Ansible/Jinja2 process the template I end up with an invalid JSON 
object because 'True' is not a valid JSON keyword:

{
  "server": True
}

I ended up doing this:

{
  "server": {{ consul_server | bool | lower }}
}

Which works... but it gets sloppy when there are a ton of variables in a 
file.

So my question, what is the proper way to interpolate boolean values in a 
JSON file?

Thank you for reading. Looking forward to the response(s).

Regards,
Phil

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7b97826-dab2-40c9-8c37-75af8fef6a83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to