# requests.exceptions.ConnectTimeout: HTTPConnectionPool

**URL:** <https://forum.ansible.com/t/requests-exceptions-connecttimeout-httpconnectionpool/24435>\
**Category:** Ansible Project\
**Tags:** windows, aws\
**Created:** [May 9, 2017, 6:31pm UTC](https://forum.ansible.com/t/requests-exceptions-connecttimeout-httpconnectionpool/24435 "2017-05-09T18:31:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramkrishnadevops25](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@ramkrishnadevops25](https://forum.ansible.com/u/ramkrishnadevops25)\
**Post date:** [May 9, 2017, 6:31pm UTC](https://forum.ansible.com/t/requests-exceptions-connecttimeout-httpconnectionpool/24435/1 "2017-05-09T18:31:02Z")

</div>

Hi,

I am running ansible playbook from centos machine to talk to windows to run basic command(ipconfig). But I am getting below error. Please help me on it.

both the instance(centos & windows) are from AWS ec2. I have added inbound port 5985 in security group to allow traffic from ec2 centos machine. your help is highly appreciated.

Error:-

**fatal: [172.28.48.57]: UNREACHABLE! =\> {**

**“changed”: false,**

**“msg”: “plaintext: HTTPConnectionPool(host=‘172.28.48.57’, port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(\<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff07175a350\>, ‘Connection to 172.28.48.57 timed out. (connect timeout=30)’))”,**

**“unreachable”: true**

**}**

Ansible playbook that I am using:

- name: test raw module

hosts: windows-instance

tasks:

- name: run ipconfig

raw: ipconfig

register: ipconfig

- debug: var=ipconfig

/etc/ansible/hosts file:

[windows-instance]

172.28.48.57

[windows-instance:vars]

ansible\_ssh\_user=Administrator

ansible\_ssh\_pass=xxxxxx #removed password

ansible\_ssh\_port=5985

ansible\_connection=winrm

Command that I am running:

ansible-playbook -i /etc/ansible/hosts windows\_playbook.yaml -vvv

Full output:

ansible-playbook -i /etc/ansible/hosts windows\_playbook.yaml -vvv

No config file found; using defaults

PLAYBOOK: windows\_playbook.yaml \*\*\*\*\*\*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*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/windows/setup.ps1

\<172.28.48.57\> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5985 TO 172.28.48.57

**fatal: [172.28.48.57]: UNREACHABLE! =\> {**

**“changed”: false,**

**“msg”: “plaintext: HTTPConnectionPool(host=‘172.28.48.57’, port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(\<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff07175a350\>, ‘Connection to 172.28.48.57 timed out. (connect timeout=30)’))”,**

**“unreachable”: true**

**}**

to retry, use: --limit @/home/rama.gopisetti/ansible/windows\_playbook.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

172.28.48.57 : ok=0 changed=0 **unreachable=1** failed=0

\*\*\*\*\*\*\*\*Same error log from python

python

Python 2.7.12 (default, Sep 1 2016, 22:14:00)

[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2

Type “help”, “copyright”, “credits” or “license” for more information.

> > > import winrm

> > > s = winrm.Session(‘172.28.48.57’, auth=(‘Administrator’, ‘Gj=aWHl@Vqc9vJO4K(-Dd3C3xTC)aA-F’))

> > > r = s.run\_cmd(‘ipconfig’, [‘/all’])

r.status\_code

r.std\_out

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/lib/python2.7/site-packages/winrm/ **init**.py”, line 37, in run\_cmd

shell\_id = self.protocol.open\_shell()

File “/usr/local/lib/python2.7/site-packages/winrm/protocol.py”, line 132, in open\_shell

res = self.send\_message(xmltodict.unparse(req))

File “/usr/local/lib/python2.7/site-packages/winrm/protocol.py”, line 207, in send\_message

return self.transport.send\_message(message)

File “/usr/local/lib/python2.7/site-packages/winrm/transport.py”, line 184, in send\_message

response = self.session.send(prepared\_request, timeout=self.read\_timeout\_sec)

File “/usr/local/lib/python2.7/site-packages/requests/sessions.py”, line 639, in send

r = adapter.send(request, \*\*kwargs)

File “/usr/local/lib/python2.7/site-packages/requests/adapters.py”, line 494, in send

raise ConnectTimeout(e, request=request)

requests.exceptions.ConnectTimeout: HTTPConnectionPool(host=‘172.28.48.57’, port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(\<requests.packages.urllib3.connection.HTTPConnection object at 0x7fd143c81a90\>, ‘Connection to 172.28.48.57 timed out. (connect timeout=30)’))

> > > r.status\_code

Traceback (most recent call last):

File “”, line 1, in

NameError: name ‘r’ is not defined

> > > r.std\_out

Traceback (most recent call last):

File “”, line 1, in

NameError: name ‘r’ is not defined

> > > exit

Use exit() or Ctrl-D (i.e. EOF) to exit
