Hello!
I'm trying to make a task that uses a REST api to do some final configuration of a previously installed component.
I want to make a POST request with a body that is a template that uses host specific variables.
The closest i've come up with is the following:
- name: Adding datasource via http api
uri:
url: http://{{ inventory_hostname }}:3000/api/datasources
method: POST
body_format: json
HEADER_Content-Type: "application/json"
body: "{{ lookup('file' , 'roles/grafana/templates/datasource.json.j2') }}"
which sends the template-file as body, but unfortunately without any variables substituted...
Any idea how i should approach the problem?