I’ve tried to make this work but can’t find any Ansible documentation stating how to do this using the URI module. I’m able to use curl with the SHELL module, but not ideal approach.
Any guidance would be appreciate it.
It sounds like you are trying to do a multipart post. In which case, just use body, and follow the example named “Upload a file via multipart/form-multipart”
I followed the steps in the section and tried several combinations of it and still get this message or something similar -
“msg”: “value of the body_format must be one of: form-urlencoded, json, raw, got: form-multipart”
*note: this is the body section of the URI module/task -
file1:
filename: “somefilename.bin”
mime_type: application/octet-stream
todo: “dosomething”
*But when I decide to use the SHELL module and the curl command it works -
curl -X POST --url https://someaddress/worktodo
-k
-H ‘Accept-Type: application/json’ \