Hi, all. I opened a ticket about this but was redirected here.
Basically, I’m having an issue where using lookup to render a template that gets passed into the uri module’s body parameter does not work. It throws an TypeError: unhashable type error.
Here’s the task I’m running:
- name: Post
uri:
url: https://hooks.slack.com/endpoint
method: POST
return_content: no
HEADER_Content-Type: “application/json”
body: “{{ lookup(‘template’, ‘…/templates/my.json.j2’, convert_data=False) }}”
with this in my.json.j2:
{
“channel”: “chatops”,
“username”: “Deploy”,
“text”: “TEST Deploy!”
}
Folding the JSON into a single line within the template has the same effect. Piping the lookup response through to_json also does not work. Taking the folded JSON and using it directly in the play does work, however.
For context, this is Ansible 1.9.4 running on OSX 10.11.1. Thanks!