Ansible: Manage Windows machine with Ansible by CredSSP

  • 22

In our previous article, we discussed basic authentication technique i.e. Managing Windows Machines with Ansible. In this article we will see managing windows machine by CredSSP authentication method.

What is CredSSP (Credential Security Support Provider)?

CredSSP authentication is a newer authentication protocol that allows credential delegation. This is achieved by encrypting the username and password after authentication has succeeded and sending that to the server using the CredSSP protocol.

Because the username and password are sent to the server to be used for double hop authentication, ensure that the hosts that the Windows host communicates with are not compromised and are trusted.

CredSSP can be used for both local and domain accounts and also supports message encryption over HTTP.


Windows Machine :- In order for Ansible to manage your windows machines, you will have to enable and configure PowerShell remoting. For more details, please visit prerequisite section of Managing Windows Machines with Ansible.
CredSSP authentication is not enabled by default on a Windows host, but can be enabled by running the following in PowerShell:

Enable-WSManCredSSP -Role Server -Force

Also it can be enabled by using ps1 script, running the following in PowerShell:

powershell.exe -File ConfigureRemotingForAnsible.ps1 -Verbose -EnableCredSSP

Ansible Control Machine :-
 On Ansible control machine we need to have python winrm module to be installed and pyOpenSSL python library. Make sure pyOpenSSL >=17.3.0

root@devops$ pip install "pywinrm>=0.2.2"
root@devops$ pip install "pyOpenSSL>=17.3.0"


Configure / Setup

Create /etc/ansible/hosts inventory file, you can add the Windows machines into this file you want to manage.




Now by using Ansible win_ping module you can test connection/setup is working

[root@ansible devops]# ansible windows -m win_ping | success >> {
    "changed": false,
    "ping": "pong"


Avinash Pawar

An automation enthusiast who presently working as DevOps Engineer.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInGoogle Plus

Avinash Pawar

An automation enthusiast who presently working as DevOps Engineer.