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.