Connecting to Windows host fails

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/). 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?

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”

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’”

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

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”

Guys, can I get any help on this?

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

Did adding

ansible_winrm_server_cert_validation: ignore

Fix this for you?

Jon

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

What configuration does it need for PowerShell?

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