# Connecting to Windows host fails

**URL:** <https://forum.ansible.com/t/connecting-to-windows-host-fails/22675>\
**Category:** Ansible Project\
**Tags:** windows, ubuntu\
**Created:** [September 29, 2016, 12:14pm UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675 "2016-09-29T12:14:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [September 29, 2016, 12:14pm UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/1 "2016-09-29T12:14:51Z")

</div>

Hi Guys,

I’m new to Ansible. I’m trying to connect to ansible windows host. I have configured for windows by following the link ([http://darrylcauldwell.com/how-to-setup-an-ansible-test-lab-for-windows-managed-nodes-custom-windows-modules/](http://darrylcauldwell.com/how-to-setup-an-ansible-test-lab-for-windows-managed-nodes-custom-windows-modules/)). Now, I’m not able to ping the windows server and getting the below error.

# ansible windows -i hosts -m win\_ping

10.20.10.179 | FAILED! =\> {  
“failed”: true,  
“msg”: “ssl: ‘Session’ object has no attribute ‘merge\_environment\_settings’”

My intention to copy a file from my Ubuntu Ansible Controller machine and run the file on Windows host. Can anyone suggest me on this?

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [September 29, 2016, 9:27pm UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/2 "2016-09-29T21:27:26Z")

</div>

You’ve got an old version of requests that’s probably owned by an OS package (IIRC Ubuntu 14.04 has this issue out of the box). pip won’t uninstall OS-owned packages, even though pywinrm declares it requires it.

You can usually fix this with:

pip install “requests\>=2.10.0”

---

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [September 30, 2016, 8:53am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/3 "2016-09-30T08:53:33Z")

</div>

Hi Matt,

I have followed the same but I’m still getting the same error. Please find the result below:

root@use-ansiblepoc:/etc/ansible# pip install “requests\>=2.10.0”  
Downloading/unpacking requests\>=2.10.0  
Downloading requests-2.11.1-py2.py3-none-any.whl (514kB): 514kB downloaded  
Installing collected packages: requests  
Found existing installation: requests 2.2.1  
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS  
Successfully installed requests  
Cleaning up…  
root@use-ansiblepoc:/etc/ansible# ansible windows -i hosts -m win\_ping  
10.20.10.179 | FAILED! =\> {  
“failed”: true,  
“msg”: “ssl: ‘Session’ object has no attribute ‘merge\_environment\_settings’”

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 30, 2016, 9:19am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/4 "2016-09-30T09:19:24Z")

</div>

It will not install from pip when the OS package is install,  
you need to remove the OS package first.  
&nbsp;&nbsp;&nbsp;apt-get purge python-requests

---

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [September 30, 2016, 10:41am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/5 "2016-09-30T10:41:40Z")

</div>

> Thanks Kai,

I worked and moved forward a bit but got the below error.

root@use-ansiblepoc:/etc/ansible# ansible windows -i hosts -m win\_ping  
10.20.10.179 | FAILED! =\> {  
“failed”: true,  
“msg”: “ssl: [Errno 1] \_ssl.c:510: error:14090086:SSL routines:SSL3\_GET\_SERVER\_CERTIFICATE:certificate verify failed”

---

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [October 7, 2016, 10:01am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/6 "2016-10-07T10:01:49Z")

</div>

Guys, can I get any help on this?

---

<div class="post-metadata">

**Author:** ![Aidan\_Gustard](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aidan\_Gustard](https://forum.ansible.com/u/Aidan_Gustard)\
**Post date:** [October 7, 2016, 11:13am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/7 "2016-10-07T11:13:08Z")

</div>

Try adding these into your group\_vars/windows.yml file.

`ansible_connection: winrm ansible_ssh_port: 5986 ansible_winrm_transport: ssl validate_certs: false ansible_winrm_server_cert_validation: ignore`

---

<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 10, 2016, 7:23am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/8 "2016-10-10T07:23:05Z")

</div>

Did adding

`ansible_winrm_server_cert_validation: ignore`

Fix this for you?

Jon

---

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [October 13, 2016, 11:49am UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/9 "2016-10-13T11:49:41Z")

</div>

No, It didn’t work. I already tried that last week. Any other option?

---

<div class="post-metadata">

**Author:** ![JayB](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JayB](https://forum.ansible.com/u/JayB)\
**Post date:** [October 13, 2016, 12:10pm UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/10 "2016-10-13T12:10:31Z")

</div>

What configuration does it need for PowerShell?

---

<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 18, 2016, 3:07pm UTC](https://forum.ansible.com/t/connecting-to-windows-host-fails/22675/11 "2016-10-18T15:07:48Z")

</div>

Running this script should do all the configuration of WinRM that is needed to control via ansible. if that is what you mean.

[https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1](https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1)
