On 16/03/19 4:25 AM, bikram40 wrote:
Hi All,

I defined a json variable in vars section and want to pass it as body in curl command as below:

Have you considered using the uri module instead?



vars:

   - paydata: {"status":"complete","message":"successfully

 completed","actions":["close ticket"]}


- local_action: command curl -X PUT -i -H "Content-Type:application/json" https://ansibledev.corp.xxxx.com:8443/api/job/{{ ticket }} -k --data "{{ paydata }}" completed","actions":["close ticket"]}' --header



But here is the error I am getting. Seems "paydata" is not passed as expected.


fatal: [10.225.240.39 -> localhost]: FAILED! => {"changed": true, "cmd": ["curl", "-X", "PUT", "-i", "-H", "Content-Type:application/json", "https://gns-ansible-dev.corp.xxx.com:8443/api/job/CRQmattcheng22";, "-k", "-d", "{ustatus:", "ucomplete,", "umessage:", "usuccessfully completed,", "uactions:", "[uclose ticket]}",



Any resolution?



Please post your playbook. It looks like the data needs proper escaping to be used in the command line.

-

Sudheer S

--
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/16082753-9e95-7e59-4b0d-590c41bff39e%40techchorus.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to