Weird Ansible parsing on JSON/Jinja2 templates
Problem
Ansible does something bad when templating JSON files, which means this code:
"{{ lookup('template', 'template.json.j2') | from_json }}"
sometimes results in the following error:
FAILED! => {"msg": "Unexpected templating type error occurred on ({{ lookup('template', 'template.json.j2') | from_json }}): expected string or buffer"}
Solution
Use convert_data=False
, as described in this commit, not yet released for some reason