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


On Wednesday, October 15, 2014 at 3:37:21 PM UTC-5, J Hawkesworth wrote:
>
> 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
> On Thursday, October 9, 2014 6:18:21 PM UTC+1, skinnedknuckles wrote:
>>
>> 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 
>> <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 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
>>
>> On Saturday, June 28, 2014 7:16:15 AM UTC-5, Trond Hindenes wrote:
>>>
>>> I'm having trouble setting Ansible with WinRM. Here's my environment:
>>> 10.10.50.4 - Win1 - the windows computer im trying to connect to from 
>>> Ansible (i've added this to the hosts file on my ansible host)
>>> 10.10.50.6 - Win2 - another windows host
>>> 10.10.50.5 - Ansible host (running Ubuntu 12.04)
>>>
>>> On Win1 I have setup a remoting endpoint using SSL (btw, the doc doesn't 
>>> state wether SSL is required or recommended. non-ssl http connections 
>>> should be an option imho)
>>> From 10.10.50.6 I can initiate a SSL-based PSremoting session to 
>>> 10.10.50.4, which should prove that the remoting endpoint and ssl is 
>>> correctly setup:
>>>
>>> $cred = Get-credential
>>> $options = New-PSSessionOption -SkipCACheck -SkipCNCheck 
>>> -SkipRevocationCheck
>>> New-PSSession -ComputerName "10.10.50.4" -UseSSL -Credential $cred 
>>> -SessionOption $options
>>>
>>> This opens a session without warnings.
>>>
>>> Here's my hosts file in ansible:
>>> azur...@th-ansible10:~/AnsibleTest/pstest$ cat hosts
>>> [windows]
>>> Win1
>>>
>>> and here's my windows groupvar file:
>>> azur...@th-ansible10:~/AnsibleTest/pstest/group_vars$ cat windows.yml
>>> # it is suggested that these be encrypted with ansible-vault:
>>> # ansible-vault edit group_vars/windows.yml
>>> ansible_ssh_user: thadministrator
>>> ansible_ssh_pass: <password>
>>> ansible_ssh_port: 5986
>>> ansible_connection: winrm
>>>
>>> Here's the command I'm attempting:
>>> azur...@th-ansible10:~/AnsibleTest/pstest$ ansible windows -i hosts -m 
>>> win_ping -vvvv
>>> <win1> ESTABLISH WINRM CONNECTION FOR USER: thadministrator on PORT 5986 
>>> TO win1
>>> <win1> WINRM CONNECT: transport=plaintext endpoint=
>>> https://win1:5986/wsman
>>> <win1> WINRM CONNECTION ERROR: Bad HTTP response returned from server. 
>>> Code 401
>>> <win1> WINRM CONNECT: transport=plaintext endpoint=
>>> http://win1:5986/wsman
>>> win1 | FAILED => Traceback (most recent call last):
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/__init__.py",
>>>  
>>> line 526, in _executor
>>>     exec_rc = self._executor_internal(host, new_stdin)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/__init__.py",
>>>  
>>> line 628, in _executor_internal
>>>     return self._executor_internal_inner(host, self.module_name, 
>>> self.module_args, inject, port, complex_args=complex_args)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/__init__.py",
>>>  
>>> line 799, in _executor_internal_inner
>>>     conn = self.connector.connect(actual_host, actual_port, actual_user, 
>>> actual_pass, actual_transport, actual_private_key_file)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection.py",
>>>  
>>> line 34, in connect
>>>     self.active = conn.connect()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/winrm.py",
>>>  
>>> line 130, in connect
>>>     self.protocol = self._winrm_connect()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/ansible-1.7-py2.7.egg/ansible/runner/connection_plugins/winrm.py",
>>>  
>>> line 86, in _winrm_connect
>>>     protocol.send_message('')
>>>   File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 
>>> 160, in send_message
>>>     return self.transport.send_message(message)
>>>   File "/usr/local/lib/python2.7/dist-packages/winrm/transport.py", line 
>>> 63, in send_message
>>>     response = urlopen(request, timeout=self.timeout)
>>>   File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
>>>     return _opener.open(url, data, timeout)
>>>   File "/usr/lib/python2.7/urllib2.py", line 400, in open
>>>     response = self._open(req, data)
>>>   File "/usr/lib/python2.7/urllib2.py", line 418, in _open
>>>     '_open', req)
>>>   File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
>>>     result = func(*args)
>>>   File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
>>>     return self.do_open(httplib.HTTPConnection, req)
>>>   File "/usr/lib/python2.7/urllib2.py", line 1180, in do_open
>>>     r = h.getresponse(buffering=True)
>>>   File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
>>>     response.begin()
>>>   File "/usr/lib/python2.7/httplib.py", line 407, in begin
>>>     version, status, reason = self._read_status()
>>>   File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
>>>     line = self.fp.readline()
>>>   File "/usr/lib/python2.7/socket.py", line 447, in readline
>>>     data = self._sock.recv(self._rbufsize)
>>> error: [Errno 104] Connection reset by peer
>>>
>>>
>>> I don't know why this is happening, and I realize that this is very much 
>>> beta code. However, there are some (potentially important) points left out 
>>> from the doc:
>>> 1. Is SSL required, or should this work using http-based connections?
>>> 2. What requirements are there on the ssl cert being used? Does the 
>>> ansible node need the public key of the cert being used on the windows 
>>> side? 
>>>
>>>
>>>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5b7c1e84-539d-4c0f-8780-1af2b07d7034%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to