not able to connect to windows host

Hi Team,

i am new to Ansible, and i am trying to connect windows host and getting below error:

[@ ~]$ ansible windows -m win_ping --ask-vault-pass -vvv
Using /etc/ansible/ansible.cfg as config file
Vault password:
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/windows/win_ping.ps1
<****> ESTABLISH WINRM CONNECTION FOR USER: khannaA.oc on PORT 5986 TO ****
****** | UNREACHABLE! => {
“changed”: false,
“msg”: “ssl: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))”,
“unreachable”: true

My Ansible version is::

$ ansible --version
ansible 2.2.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

my windows.yml file is:

ansible_user: ******
ansible_password: ******
ansible_port: 5986
ansible_connection: winrm
#ansible_winrm_scheme: http

The following is necessary for Python 2.7.9+ (or any older Python that has backported SSLContext, eg, Python 2.7.5 on RHEL7) when using default WinRM self-signed certificates:

ansible_winrm_server_cert_validation: ignore

i am able to ping/telnet to the windows host from ansible master.

Please suggest.

Thanks,
Akshay

I've had similar issues before:
1. Has the Windows box had configureforansibleremoting.ps1 run on it?

2. Is DNS resolvable for the server?

3. Have you tried running configureforansibleremoting.ps1 with the extra arguments to recreate the winrm certificate?

4. Is the Windows server a VM cloned from a template?

5. What pywinrm version?

Hello,

Has this issue been resolved for you? I am running into a similar issue against Windows 2008r2. My Ansible version is 2.3.0.0
I’m not seeing this kind of error against vm(s) spun-up off of a 2012r2 image. Everything works fine on a 2012r2 target host.

Here is the error I am facing:

TASK [Gathering Facts] ******************************************************************************************************************************************************************************
fatal: [brauwebt4]: UNREACHABLE! => {“changed”: false, “msg”: “ssl: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))”, “unreachable”: true}

FYI, Winrm is configured, updated the powershell version to 4.0 too…
Anybody has any fix / workaround to get past this issue? Any help would be appreciated… Thanks in advance…

If its an unpatched or fresh S2008R2 vm the following may apply. (from the docs at the bottom of this section of the documentation: http://docs.ansible.com/ansible/intro_windows.html#windows-system-prep):

"On Windows 7 and Server 2008 R2 machines, due to a bug in Windows Management Framework 3.0, it may be necessary to install this hotfix http://support.microsoft.com/kb/2842230 to avoid receiving out of memory and stack overflow exceptions. Newly-installed Server 2008 R2 systems which are not fully up to date with windows updates are known to have this issue.

Windows 8.1 and Server 2012 R2 are not affected by this issue as they come with Windows Management Framework 4.0."

Hope this hlps,

Jon