fail to use uri to POST file to a service

84 views
Skip to first unread message

Tzach Livyatan

unread,
Apr 4, 2015, 3:26:00 PM4/4/15
to ansible...@googlegroups.com
Hello
The following curl from the host to the provision servers works fine:
 curl -X POST --header "Content-Type: application/json" -d @file.json http://public-ip/api

Trying to use uri module for the same, I used:
- local_action: uri url=http://public-ip/api method=POST body="{{ lookup('file','file.json') }}" HEADER_Content-Type="application/json"
 sudo: false

Only to get 
msg: this module requires key=value arguments

Any idea whats going on here?
Thanks



Romeo Theriault

unread,
Apr 5, 2015, 9:50:31 PM4/5/15
to ansible...@googlegroups.com
Try changing the body to something simple and seeing if it works. I'm guessing that something inside of the file.json that is causing a parse error. One option is to put the contents of the file.json directly into the body="{ jsonk: 'jsonv', }"

Hope that helps.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7bb1abc8-74f2-41c2-a4ac-4106718926ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Romeo
Reply all
Reply to author
Forward
0 new messages