How to render boolean true in j2 file?

16 views
Skip to first unread message

Neil Young

unread,
Nov 8, 2021, 9:21:55 AM11/8/21
to Ansible Project
I'm not entirely sure if this is a YAML problem or an Ansible thing.

Trying to render a configuration json file from a j2 template.

Template.j2

{
  "test": {{ boolean_test }}
}

default.yml:

boolean_test: true

Result:

{
  "test": True
}

The result makes my node app complain (invalid json)

How to render 

{
  "test": true
}

?

Neil Young

unread,
Nov 8, 2021, 9:33:02 AM11/8/21
to Ansible Project

Found it:

default.yml:

boolean_test: !!str true




Reply all
Reply to author
Forward
0 new messages