Hi,
I am trying to use ansible to controla windows 10 desktop VM in my lab and cannot seem to get past the connection error.Appreciate your help here.
Here is my setup:
MacBook is the control host and trying to connect to a windows10 desktop VM. I went through and followed all instructions in the ansible doc to enable remotePowershell on windows VM, turned OFF firewall on the windows VM.The windows VM is not part of any domain.
My inventory file:
[windows]
10.203.189.4
[windows:vars] #group variables and values as a string
ansible_connection=winrm
ansible_user= voiceqa
ansible_password = abcdef
ansible_port=5986
ansible_winrm_server_cert_validation= ignore
I get the following error:
$ ansible windows --inventory-file=./hosts -m win_ping -vvvvv
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
<10.203.189.4> ESTABLISH WINRM CONNECTION FOR USER: voiceqa on PORT 5986 TO 10.203.189.4
<10.203.189.4> WINRM CONNECT: transport=ssl endpoint=https://10.203.189.4:5986/wsman
<10.203.189.4> WINRM CONNECTION ERROR: HTTPSConnectionPool(host=‘10.203.189.4’, port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10e61c8d0>: Failed to establish a new connection: [Errno 61] Connection refused’,))
Traceback (most recent call last):
File “/Users/dnveer/venv/vqp/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py”, line 134, in _winrm_connect
protocol.send_message(‘’)
File “/Users/dnveer/venv/vqp/lib/python2.7/site-packages/winrm/protocol.py”, line 207, in send_message
return self.transport.send_message(message)
File “/Users/dnveer/venv/vqp/lib/python2.7/site-packages/winrm/transport.py”, line 173, in send_message
response = self.session.send(prepared_request, timeout=self.read_timeout_sec)
File “/Users/dnveer/venv/vqp/lib/python2.7/site-packages/requests/sessions.py”, line 585, in send
r = adapter.send(request, **kwargs)
File “/Users/dnveer/venv/vqp/lib/python2.7/site-packages/requests/adapters.py”, line 467, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host=‘10.203.189.4’, port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10e61c8d0>: Failed to establish a new connection: [Errno 61] Connection refused’,))
10.203.189.4 | FAILED! => {
“failed”: true,
“msg”: “ssl: HTTPSConnectionPool(host=‘10.203.189.4’, port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10e61c8d0>: Failed to establish a new connection: [Errno 61] Connection refused’,))”
}