Connecting to Windows host fails

476 views
Skip to first unread message

JayB

unread,
Sep 29, 2016, 12:41:57 PM9/29/16
to Ansible Project
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?

Matt Davis

unread,
Sep 29, 2016, 5:27:27 PM9/29/16
to Ansible Project
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"

JayB

unread,
Sep 30, 2016, 4:53:33 AM9/30/16
to Ansible Project
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

Kai Stian Olstad

unread,
Sep 30, 2016, 5:19:47 AM9/30/16
to ansible...@googlegroups.com
On 30.09.2016 10:53, JayB wrote:
> 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

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

--
Kai Stian Olstad

JayB

unread,
Sep 30, 2016, 6:41:40 AM9/30/16
to Ansible Project, ansible-pr...@olstad.com
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"
 

JayB

unread,
Oct 7, 2016, 6:01:49 AM10/7/16
to Ansible Project, ansible-pr...@olstad.com
Guys, can I get any help on this?

Aidan Gustard

unread,
Oct 7, 2016, 11:27:23 AM10/7/16
to Ansible Project, ansible-pr...@olstad.com
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

J Hawkesworth

unread,
Oct 10, 2016, 3:23:05 AM10/10/16
to Ansible Project, ansible-pr...@olstad.com
Did adding

ansible_winrm_server_cert_validation: ignore

Fix this for you?

Jon

JayB

unread,
Oct 13, 2016, 7:49:42 AM10/13/16
to Ansible Project, ansible-pr...@olstad.com
No, It didn't work. I already tried that last week. Any other option?

JayB

unread,
Oct 13, 2016, 8:10:31 AM10/13/16
to Ansible Project, ansible-pr...@olstad.com
What configuration does it need for PowerShell?

J Hawkesworth

unread,
Oct 18, 2016, 11:07:48 AM10/18/16
to Ansible Project, ansible-pr...@olstad.com
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
Reply all
Reply to author
Forward
0 new messages