I have a problem using uri when behind a proxy. There is an exception in the python module.
This works well when not going through a proxy. But fails when a proxy is set.
- uri: url=“http://www.google.com” dest=“/tmp/tempfile”
fatal: [h39]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “uri”}, “module_stderr”: “”, “module_stdout”: “Traceback (most recent call last):\r\n File "/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri", line 2439, in \r\n main()\r\n File "/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri", line 453, in main\r\n resp, content, dest = uri(module, url, dest, user, password, body, body_format, method, dict_headers, redirects, socket_timeout, validate_certs)\r\n File "/root/.ansible/tmp/ansible-tmp-1456764961.49-135649813587956/uri", line 340, in uri\r\n resp, content = h.request(url, method=method, body=body, headers=headers) \r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/init.py", line 1609, in request\r\n (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)\r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/init.py", line 1351, in _request\r\n (response, content) = self._conn_request(conn, request_uri, method, body, headers)\r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/init.py", line 1272, in _conn_request\r\n conn.connect()\r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/init.py", line 916, in connect\r\n self.sock.connect((self.host, self.port) + sa[2:])\r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/socks.py", line 424, in connect\r\n self.__negotiatehttp(destpair[0], destpair[1])\r\n File "/usr/local/lib/python2.7/dist-packages/httplib2/socks.py", line 390, in __negotiatehttp\r\n raise HTTPError((statuscode, statusline[2]))\r\nhttplib2.socks.HTTPError: (403, ‘Forbidden’)\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
When listening on my proxy server, I realized that uri is trying to HTTP CONNECT to google, rather that using GET. I compared with what wget or curl are doing and both of them are sending GET to the proxy.
Anyone has faced the same issue?
I am using version 2.0.0.1 of Ansible.
The remote node is running ubuntu 14.04.04