hey guys,
I need to inject a .json file into an application using ansible.
I know that we have a module called URI. However this application accepts only by Content-Type: “application/x-www-form-urlencoded” … in this case, I can’t use “src:file.json” Is that correct? …
Do I need to create a variable file with all data and pass it using “body: {{ fields }}”?
Thank you
Regards
RG
hey guys,
I need to inject a .json file into an application using ansible.
I know that we have a module called URI. However this application accepts only by Content-Type: "application/x-www-form-urlencoded" ... in this case, I can't use "src:file.json" Is that correct? ..
Not sure - but what combination(s) did you try, and what was the outcome?
Do I need to create a variable file with all data and pass it using "body: {{ fields }}"?
The docs indicate that file uploads should be done using 'src':
https://docs.ansible.com/ansible/latest/modules/uri_module.html#parameter-src
But you can override headers:
https://docs.ansible.com/ansible/latest/modules/uri_module.html#parameter-headers
This combination should do what you want.