# Problems setting up WinRM

**URL:** <https://forum.ansible.com/t/problems-setting-up-winrm/15571>\
**Category:** Ansible Project\
**Tags:** windows, ubuntu\
**Created:** [June 28, 2014, 12:16pm UTC](https://forum.ansible.com/t/problems-setting-up-winrm/15571 "2014-06-28T12:16:15Z")\
**Posts on this page:** 4\
**Page:** 2

<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 9, 2014, 5:18pm UTC](https://forum.ansible.com/t/problems-setting-up-winrm/15571/21 "2014-10-09T17:18:21Z")

</div>

I’ve reinstalled everything and am still having trouble getting win\_ping to work. Here is my info:  
Fedora 20  
Ansible 1.7.1  
Remote node running windows 7  
The WinRM script by Trond runs without errors on the remote node  
Control and Remote Machines are both on Lan with common domain w/o firewalls  
So far as I can tell I’ve installed everything on control and remote machine as described in documentation

My inventory file contains  
[windows]  
123.123.123.123

My windows.yml file is in the group\_vars directory and contains  
ansible\_ssh\_user: Administrator  
ansible\_ssh\_pass: ansiblepw  
ansible\_ssh\_port: 5986  
ansible\_connection: winrm

Should this file begin with “—”?

Can you tell what I’m doing wrong? Do you need any more information?

[ansmgr@dhcp1-59-159 ansible]$ ansible windows -m win\_ping --ask-pass -vvvv  
SSH password:  
\<123.123.123.123\> ESTABLISH WINRM CONNECTION FOR USER: Administrator 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 549, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/etc/ansible/lib/ansible/runner/ **init**.py”, line 707, 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 870, 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:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [October 15, 2014, 8:37pm UTC](https://forum.ansible.com/t/problems-setting-up-winrm/15571/22 "2014-10-15T20:37:21Z")

</div>

Don’t know for sure what is going on here but a couple of suggestions…

Check the winrm config and ensure basic auth is enabled:

**winrm get winrm/config/**

if basic auth is false set it to true (instructions further up in this thread).

You mention that both machines are on common domain but right now Ansible will not work with domain user accounts - so check that you are actually using a local account in your windows.yml.

Your windows.yml file shouldn’t need to start with — - mine doesn’t anyway.

I had an issue with a windows server 2008 box that wasn’t up to date with windows updates which caused winrm to fail as it was setting a very small limit on the allowed process size for commands run via winrm. There was a specific patch for it but worth checking windows update is fully up to date if that’s an option for you.

Your setup sounds pretty similar to one I have had working in the past. My controller was running centos 6.3 and I had it working against a win 7 host using a local account.

Hope this helps, let us know how you get on.

Jon

---

<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 15, 2014, 8:57pm UTC](https://forum.ansible.com/t/problems-setting-up-winrm/15571/23 "2014-10-15T20:57:47Z")

</div>

Thanks J for your suggestions.

I am using the Trond Hindenes powershell script to configure my windows remote node and it always returns “ok”  
I believe I have basic auth enabled because the script contains these lines

#Check for basic authentication

$basicauthsetting = Get-ChildItem WSMan:\localhost\Service\Auth | where {$\_.Name -eq “Basic”}

if (($basicauthsetting.Value) -eq $false)

{

Write-Verbose “Enabling basic auth”

Set-Item -Path “WSMan:\localhost\Service\Auth\Basic” -Value $true

}

Else

{

Write-verbose “basic auth already enabled”

}

I will check on the local account issue you raised and let you know if that works.

Also my remote node is not a server. It is running Windows 7 sp1 and powershell ver 3.

I’m switching from Fedora to CentOs 7.0. I haven’t made much progress overall but at least I’m becoming very familiar with the Windows system prep on the control machine. I’ve done it 4 times now and am going to try a 5th in a few minutes.

Thanks again,

Jonathan

---

<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:29am UTC](https://forum.ansible.com/t/problems-setting-up-winrm/15571/24 "2015-04-26T01:29:12Z")

</div>

It’s fixed now. Here’s my windows.yml file contents

ansible\_ssh\_user: ansible  
ansivle\_ssh\_pass: ansible123  
ansible\_ssh\_port: 5986  
ansible\_connection: winrm

It seems that the 3rd line of my windows.yml file “ansible\_ssh\_port: 5986” was not doing it’s job because I appended my computer name with the port number and everything worked fine. So I’ve deleted the 3rd line of my windows.yml file and now my host file is

[windows]  
ComputerName:5986

[Previous page](https://forum.ansible.com/t/problems-setting-up-winrm/15571.md?page=1)
