Using Ansible with remote nodes running Windows 7

1,244 views
Skip to first unread message

skinnedknuckles

unread,
Oct 24, 2014, 2:05:32 PM10/24/14
to ansible...@googlegroups.com
Has anyone succeeded at running ansible with a remote node running Windows 7?  I'm having problems getting win-ping to work in this configuration.  I've tried Fedora 20 and CentOs7 with Ansible 1.8.  My inventory and windows.yml files are good and I've run 


Here is my debug output.

[ansmgr@localhost ansible]$ ansible windows -c winrm -m win_ping --ask-pass -vvvv
SSH 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
<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
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

Chris Church

unread,
Oct 25, 2014, 3:29:07 PM10/25/14
to ansible...@googlegroups.com
It seems like there may be a firewall/config issue preventing you from connecting.  Can you try the following using curl?

curl -vk -d "" -u "user:pass" "https://host:5986/wsman"

You should get a 411 status code if the connection and authentication worked as expected.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6e7dd49d-d56b-4f2e-8254-9ab0fd2a96f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Oct 26, 2014, 6:56:57 PM10/26/14
to ansible...@googlegroups.com
I've had a couple of a occasions where I thought I had the firewall rules set right on my windows hosts but eventually realised they were set for the wrong profile - if you aren't connecting as a domain user make sure the profile is 'public', for example.

skinnedknuckles

unread,
Nov 7, 2014, 10:27:44 AM11/7/14
to ansible...@googlegroups.com
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"}'
Reply all
Reply to author
Forward
0 new messages