I am running an ansible script that returned an error message anytime I have added a JSON payload
TASK: [uri url=http://ec2-54-164-162-26.compute-1.amazonaws.com:7777/mmc-support method=POST user=admin password=admin return_content=yes HEADER_Content-Type=“‘application/json’ ec2-54-165-243-43.compute-1.amazonaws.com:8080/mmc/api/servers”] ***
failed: [ip-172-31-57-168.ec2.internal] => {“failed”: true, “parsed”: false}
Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-tmp-1460552910.1-66349999814421/uri”, line 2081, in
main()
File “/root/.ansible/tmp/ansible-tmp-1460552910.1-66349999814421/uri”, line 416, in main
resp, content, dest = uri(module, url, dest, user, password, body, method, dict_headers, redirects, socket_timeout, validate_certs)
File “/root/.ansible/tmp/ansible-tmp-1460552910.1-66349999814421/uri”, line 312, in uri
resp, content = h.request(url, method=method, body=body, headers=headers)
File “/usr/lib/python2.7/site-packages/httplib2/init.py”, line 1605, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File “/usr/lib/python2.7/site-packages/httplib2/init.py”, line 1353, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File “/usr/lib/python2.7/site-packages/httplib2/init.py”, line 1323, in _conn_request
response = conn.getresponse()
File “/usr/lib64/python2.7/httplib.py”, line 1051, in getresponse
response.begin()
File “/usr/lib64/python2.7/httplib.py”, line 415, in begin
version, status, reason = self._read_status()
File “/usr/lib64/python2.7/httplib.py”, line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ‘’
FATAL: all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/master.retry
ip-172-31-57-168.ec2.internal : ok=37 changed=14 unreachable=0 failed=1
Here is the YAML :
- uri: >
url=http://{{ mule_urlagent }}:7777/mmc-support
method=POST
user=admin
password=admin
return_content=yes
HEADER_Content-Type=“‘application/json’ ec2-54-165-243-43.compute-1.amazonaws.com:8080/mmc/api/servers”