---
- hosts: localhost
tasks:
- uri:
url: https://url/to/the/dest/server
<https://10.110.80.101/api/v1/host-switch-profiles>
method: POST
user: admin
password: default
force_basic_auth: yes
body: '{JSON payload}'
body_format: json
register: payloadop
- name: Print command output
action: command echo item
with_items: payloadop.stdout
On Wednesday, October 14, 2015 at 4:35:41 PM UTC+5:30, Sharwari Phadnis
wrote:
>
> So, to send payload body parameter could be used?
>
> On Wednesday, October 14, 2015 at 4:33:29 PM UTC+5:30, David Karban wrote:
>>
>> Hi,
>>
>> this error usually means problem in indentation, body souhld be two
>> spaces deeper I guess. But cannot be sure, as you have not sent your task
>> here :).
>>
>> David Karban
>> Linux server specialist/Specialista na správu linuxových serverů
>> www.karban.eu
>>
>> 2015-10-14 12:59 GMT+02:00 Sharwari Phadnis <[email protected]>:
>>
>>> I am trying to *send a payload(in JSON)* to a destination mentioned in
>>> the URL. For this purpose I am using* uri module and POST method*. How
>>> can I send it using uri module? I am using ansible* version 1.9.1* and
>>> when I tried to use *body parameter* for uri module it shows the
>>> following error:* body is not a legal parameter in an Ansible task or
>>> handler*.
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/a396f9dd-370d-44d9-9a21-149901848f88%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/ansible-project/a396f9dd-370d-44d9-9a21-149901848f88%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a60131dc-9590-43f4-ae25-4ea839d18833%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.