Ansible ping to Windows fails with credssp , “Session' object has no attribute 'merge_environment_settings”

I have configured Ansible on my ubuntu 14.04 and my target machine is a windows server 2016, but it fails when using credssp or plain text:

I tried: ansible -m win_ping all --ask-pass -vvvvvvv

Below is the output I see:

ansible 2.5.3
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]
Using /etc/ansible/ansible.cfg as config file
SSH password:
setting up inventory plugins
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/minimal.pyc
META: ran handlers
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_ping.ps1
<HARSHTSR-domain.com> ESTABLISH WINRM CONNECTION FOR USER: GAR\ad_harshtsr on PORT 5985 TO HARSHTSR-domain.com
checking if winrm_host HARSHTSR-domain.com is an IPv6 address
<HARSHTSR-domain.com> WINRM CONNECT: transport=credssp endpoint=http://HARSHTSR-domain.com:5985/wsman
<HARSHTSR-domain.com> WINRM CONNECTION ERROR: ‘Session’ object has no attribute ‘merge_environment_settings’
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py”, line 356, in _winrm_connect
self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
File “/usr/local/lib/python2.7/dist-packages/winrm/protocol.py”, line 157, in open_shell
res = self.send_message(xmltodict.unparse(req))
File “/usr/local/lib/python2.7/dist-packages/winrm/protocol.py”, line 234, in send_message
resp = self.transport.send_message(message)
File “/usr/local/lib/python2.7/dist-packages/winrm/transport.py”, line 243, in send_message
self.build_session()
File “/usr/local/lib/python2.7/dist-packages/winrm/transport.py”, line 156, in build_session
settings = session.merge_environment_settings(url=self.endpoint, proxies={}, stream=None,
AttributeError: ‘Session’ object has no attribute ‘merge_environment_settings’

(changed actual domain name to domain.com above).

I have all the necessary modules installed:

pywinrm requests requests-credssp.

Can someone please help here?

my requests version is 2.9.1

pywinrm version is 0.3.0

Sounds like you have the issue described here: https://groups.google.com/forum/#!topic/ansible-project/ez68TZQciXE

Yep as stated in the post linked above, you have a system version of requests that is too old for pywinrm, please run “pip install requests --upgrade --force-reinstall” to make sure you are reinstalling the latest version from pip.

Thanks

Jordan