Ansible on Windows (with credssp) running into issues.

Hi,

I am trying to control a windows 2016 server host using Ansible control machine( CentOS)

I followed the steps mentioned in http://docs.ansible.com/ansible/latest/intro_windows.html#id18

But I ran into issues and need help

Steps I followed.

  1. Setup Ansible Controller machine in CentOS
  2. Installed pip install “pywinrm>=0.2.2”
  3. Installed pip install pywinrm[credssp]
  4. Set up group_vars/windows.yml on my Ansible controller machine with contents as below

ansible_user: Administrator
ansible_password: RandomePassword
ansible_port: 5985
ansible_winrm_scheme: http

ansible_connection: credssp

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

  1. Setup Windows host as per this link http://docs.ansible.com/ansible/latest/intro_windows.html#windows-system-prep

  2. I ran command to test connection and I got error as shown below.

root@MycentOS # ansible [windowsIP] -m ping
windowsIP | FAILED! => {
“failed”: true,
“msg”: “the connection plugin ‘credssp’ was not found”
}

Can you please let me know what is going wrong.

Thanks,
Vishnu

Hi

ansible_connection should be ‘winrm’ and you can set the auth mode using ansible_transport. So ultimately your vars should be;

ansible_user: Administrator
ansible_password: RandomePassword
ansible_port: 5985
ansible_winrm_scheme: http
ansible_connection: winrm
ansible_winrm_transport: credssp
ansible_winrm_server_cert_validation: ignore

One thing I would recommend is to use HTTPS instead of just HTTP. If you used the ConfigureRemotingForAnsible.ps1 script to set up WinRM you can just change ansible_port to 5986 and remove ansible_winrm_scheme to do this.

Thanks

Jordan