Hi Pawan You state: "Curl command is working fine on command line shell". But in fact, it is not working fine, because it exits with error code 3, which (according to https://curl.haxx.se/libcurl/c/libcurl-errors.html) means "The URL was not properly formatted." You would have seen that if you didn't suppress the output with the "-s" (silent) switch. Running the same command from ansible shell will give exactly the same result, but ansible is more vocal about non-zero exit codes and hence will complain.
Remove the "-s" switch and try to manually tweak the curl command so that it yields something useful (preferably something that cleanly exits). Once that works, it will also work in ansible shell/command. Dick On Thu, 6 Feb 2020 at 17:09, Pawan Kumar <[email protected]> wrote: > > > > Hi Team, > > Curl command is working fine on command line shell ,but when running the same > command using Ansible shell module it's throwing error . > The exact issue coming when i am using curl command with multiple parameters > (example -i /opt/hosts proxy ) . > > Here is my playbook > > > - name: list for idp > shell: 'curl -s http://localhost:8095/proxy/healthcheck -i /opt/hosts > proxy ' > register: idp_out > > - debug: > msg: "{{idp_out}}" > > > Output --- > > > fatal: [localhost]: FAILED! => {"changed": true, "cmd": "curl -s > http://localhost:8095/proxy/healthcheck -i /opt/hosts", "delta": > "0:00:00.016367", "end": "2020-02-06 08:00:08.153617", "msg": "non-zero > return code", "rc": 3, "start": "2020-02-06 08:00:08.137250", "stderr": "", > "stderr_lines": [], "stdout": "HTTP/1.1 200 OK\r\nDate: Thu, 06 Feb 2020 > 16:00:08 GMT\r\nContent-Type: application/json\r\nContent-Length: > 159\r\n\r\n{\"package\":\"PROXY\" > > > While running the same curl command on linux shell , it's working fine. > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/d2ba46f1-ca60-49fa-b0ee-f889a6639de4%40googlegroups.com. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNrx4r9t8UAev-Q_ZW8Z2uws%2BjLRj-u4_-vn5MuEHtw_g%40mail.gmail.com.
