# Connection reset by peer

**URL:** <https://forum.ansible.com/t/connection-reset-by-peer/16508>\
**Category:** Ansible Project\
**Tags:** windows, fedora\
**Created:** [October 14, 2014, 7:16pm UTC](https://forum.ansible.com/t/connection-reset-by-peer/16508 "2014-10-14T19:16:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jonathan\_Anderson](https://forum.ansible.com/u/Jonathan_Anderson)\
**Post date:** [October 14, 2014, 7:16pm UTC](https://forum.ansible.com/t/connection-reset-by-peer/16508/1 "2014-10-14T19:16:01Z")

</div>

I’ve been trying to get win\_ping to work for weeks now so I’d be so grateful if someone could help identify my problem.

System details

Fedora 20  
Ansible ver 1.8

Here are my setup commands (from a clean Fedora install).

sudo yum install gcc  
sudo yum install git  
sudo yum install python  
sudo yum install python-setuptools python-setuptools-devel  
sudo yum install python-devel  
sudo yum install python2-devel  
sudo yum install python-pip  
sudo yum install rpm-build  
sudo git clone git://github.com/ansible/ansible.git /etc/ansible

The following command never works for me.  
cd /etc/ansible  
sudo make rpm

sed “s/%VERSION%/1.8/” docs/man/man1/ansible-doc.1.asciidoc.in \> docs/man/man1/ansible-doc.1.asciidoc  
/bin/sh: docs/man/man1/ansible-doc.1.asciidoc: Permission denied  
make: \*\*\* [docs/man/man1/ansible-doc.1.asciidoc] Error 1

sudo pip install [http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm](http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm)  
sudo cp /etc/ansible/lib/ansible/module\_utils/powershell.ps1 /usr/lib/python2.7/site-packages/ansible/module\_utils

source ./hacking/env-setup

How do I install Python 2.7 without installing Python 3.x?  
Are any of my setup commands above redundant or unnecessary?

Here is my inventory

[ansmgr@dhcp1-59-159 ansible]$ cat hosts  
[windows]

123.123.123.123

Here I specify that I’m using powershell instead of ssh

[ansmgr@dhcp1-59-159 group\_vars]$ cat windows.yml  
ansible\_ssh\_user: ansmgr

ansible\_ssh\_pass: ansiblepw  
ansible\_ssh\_port: 5986  
ansible\_connection: winrm

I have installed powershell on my remote node and have run the Trond Hindenes script with “Basic -value $true”

Here is the debug output of my win\_ping command.

[ansmgr@dhcp1-59-159 ansible]$ ansible all -i hosts -m win\_ping --ask-vault-pass -vvvv  
Vault password:  
\<123.123.123.123\> ESTABLISH WINRM CONNECTION FOR USER: ansmgr on PORT 5986 TO 123.123.123.123  
\<123.123.123.123\> WINRM CONNECT: transport=plaintext endpoint=[https://123.123.123.123:5986/wsman](https://123.123.123.123:5986/wsman)  
\<123.123.123.123\> WINRM CONNECTION ERROR: 500 WinRMTransport. [Errno 104] Connection reset by peer  
\<123.123.123.123\> WINRM CONNECT: transport=plaintext endpoint=[http://123.123.123.123:5986/wsman](http://123.123.123.123:5986/wsman)  
123.123.123.123 | FAILED =\> Traceback (most recent call last):  
File “/etc/ansible/lib/ansible/runner/ **init**.py”, line 559, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/etc/ansible/lib/ansible/runner/ **init**.py”, line 732, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/etc/ansible/lib/ansible/runner/ **init**.py”, line 895, in \_executor\_internal\_inner  
conn = self.connector.connect(actual\_host, actual\_port, actual\_user, actual\_pass, actual\_transport, actual\_private\_key\_file)  
File “/etc/ansible/lib/ansible/runner/connection.py”, line 44, in connect  
self.active = conn.connect()  
File “/etc/ansible/lib/ansible/runner/connection\_plugins/winrm.py”, line 132, in connect  
self.protocol = self.\_winrm\_connect()  
File “/etc/ansible/lib/ansible/runner/connection\_plugins/winrm.py”, line 86, in \_winrm\_connect  
protocol.send\_message(‘’)  
File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 173, in send\_message  
return self.transport.send\_message(message)  
File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 76, in send\_message  
response = urlopen(request, timeout=self.timeout)  
File “/usr/lib64/python2.7/urllib2.py”, line 127, in urlopen  
return \_opener.open(url, data, timeout)  
File “/usr/lib64/python2.7/urllib2.py”, line 404, in open  
response = self.\_open(req, data)  
File “/usr/lib64/python2.7/urllib2.py”, line 422, in \_open  
‘\_open’, req)  
File “/usr/lib64/python2.7/urllib2.py”, line 382, in \_call\_chain  
result = func(\*args)  
File “/usr/lib64/python2.7/urllib2.py”, line 1216, in http\_open  
return self.do\_open(httplib.HTTPConnection, req)  
File “/usr/lib64/python2.7/urllib2.py”, line 1189, in do\_open  
r = h.getresponse(buffering=True)  
File “/usr/lib64/python2.7/httplib.py”, line 1045, in getresponse  
response.begin()  
File “/usr/lib64/python2.7/httplib.py”, line 409, in begin  
version, status, reason = self.\_read\_status()  
File “/usr/lib64/python2.7/httplib.py”, line 365, in \_read\_status  
line = self.fp.readline(\_MAXLINE + 1)  
File “/usr/lib64/python2.7/socket.py”, line 476, in readline  
data = self.\_sock.recv(self.\_rbufsize)  
error: [Errno 104] Connection reset by peer

---

<div class="post-metadata">

**Author:** ![Jonathan\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jonathan\_Anderson](https://forum.ansible.com/u/Jonathan_Anderson)\
**Post date:** [November 7, 2014, 3:28pm UTC](https://forum.ansible.com/t/connection-reset-by-peer/16508/2 "2014-11-07T15:28:28Z")

</div>

There must be a problem with my encryption because when I run this line in powershell it works.

winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’

---

<div class="post-metadata">

**Author:** ![Jonathan\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@Jonathan\_Anderson](https://forum.ansible.com/u/Jonathan_Anderson)\
**Post date:** [April 26, 2015, 1:45am UTC](https://forum.ansible.com/t/connection-reset-by-peer/16508/3 "2015-04-26T01:45:26Z")

</div>

Okay this is fixed. The values assigned to the variables “ansible\_ssh\_user” and “ansible\_ssh\_pass” must:

1. Exactly match an account on the windows machine with admin privileges (account must exist but need NOT be current active login)

2. If you are using SSL and the value of winrm/config/service/AllowUnencrypted is true (this is the default) the values in ansible\group\_vars\windows.yml must exactly match the username and password that was submitted to generate the SSL web certificate.

In my case I also had to append the computer name with the port number in the inventory like this

[windows]  
ComputerName:5986

(or 5985 for AllowUnedcrypted=“true” type this command in powershell PS C:\winrm set winrm/config/service ‘@{AllowUnencrypted=“true”}’

done.
