Affiliate-Exclusive: Get up to 35% off sitewide on CKA, CKAD, CKS, KCNA, KCSA exams and bundles!

Ansible Automation for Windows

Ansible Automation for Windows

Ansible’s reputation as a Linux automation powerhouse is well-deserved. But a common misconception lingers: is Ansible strictly for Linux environments? The answer? Absolutely not!

While Ansible itself doesn’t run natively on Windows, its magic lies in its ability to orchestrate tasks across a wide range of platforms. That includes your Windows servers and desktops, alongside network devices, firewalls, cloud infrastructure, containers, and more. This opens the door to managing your entire IT landscape with a single, powerful tool, streamlining processes, boosting efficiency, and minimizing human error. So, if you’re looking to automate Windows management or explore Ansible’s broader capabilities, keep reading – you might be surprised!

This is a collection of articles and references about Windows automation using Ansible, published in techbeatly and other platforms.

Do you know, you have more than 80 Windows modules available from the Ansible Community?

Guides for Configuring Windows Machine

The first step is to configure your Windows machine to be managed by Ansible. Follow below guides to configure the Windows system with and without SSL methods.

Ansible talks to Windows

Unlike SSH for Linux machines, Ansible uses Windows PowerShell remoting to automate Windows. Ansible uses the WinRM (Windows Remote Management) protocol which is Microsoft’s built-in HTTP-based remote management technology.

Refer to Windows Remote Management to learn more.

What is ansible_winrm_transport?

ansible_winrm_transport defines the authentication method Ansible uses when connecting to a Windows host over WinRM. It is not the same as transport-layer encryption (HTTP vs HTTPS) — it controls how credentials are verified.

Authentication Options Overview

The following matrix is a high level overview of the authentication options:

OptionLocal AccountsActive Directory AccountsCredential DelegationHTTP Encryption
BasicYesNoNoNo
CertificateYesNoNoNo
KerberosNoYesYesYes
NTLMYesYesNoYes
CredSSPYesYesYesYes

Transport vs Account Type vs Encryption — Full Matrix

TransportConnection PluginLocal AccountAD/Domain AccountHTTP (5985)HTTPS (5986)Credential DelegationExtra Setup Required
basicwinrm⚠️ unsafe✅ safeEnable Basic auth on Windows
basicpsrp⚠️ unsafe✅ safeEnable Basic auth on Windows
ntlmwinrm✅ msg-encryptNone (enabled by default)
negotiatepsrp✅ msg-encrypt❌ (✅ if Kerberos)None — tries Kerberos first, falls back to NTLM
kerberoswinrm✅ msg-encryptkrb5 libs + /etc/krb5.conf + kinit
kerberospsrp✅ msg-encryptSame as above
credsspwinrm✅ msg-encryptEnable CredSSP on Windows + extra pip libs
credssppsrp✅ msg-encryptEnable CredSSP on Windows + extra pip libs
certificatewinrm✅ requiredClient cert + mapped to local user
certificatepsrp✅ requiredClient cert + mapped to local user

Certificate Requirements per Auth Type

TransportListener Certificate (Server)Client CertificateCertificate Authority
basicOptional (needed for HTTPS)❌ not neededSelf-signed OK
ntlmOptional (needed for HTTPS)❌ not neededSelf-signed OK
kerberosOptional (needed for HTTPS)❌ not neededAD CS recommended for domain
credsspOptional for HTTPS listener; CredSSP auto-generates its own TLS cert❌ not neededSelf-signed OK (no validation on CredSSP cert)
certificateRequired (HTTPS mandatory)Required — mapped to local userSelf-signed OK, or AD CS

HTTP vs HTTPS Safety Summary

TransportHTTP (5985) safe?HTTPS (5986) safe?Why
basic❌ No✅ YesPassword is only Base64 encoded — TLS is the only protection
ntlm⚠️ Acceptable✅ YesHas message-level encryption; official docs warn against HTTP use
kerberos✅ Yes✅ YesMessage-level encryption built in
credssp✅ Yes✅ YesMessage-level encryption built in; but sends credentials to host
certificate❌ Never✅ YesRequires HTTPS by design

Python Library Requirements (Ansible Controller Side)

Transportwinrm pluginpsrp plugin
basic / ntlm / certificatepywinrm>=0.4.0pypsrp<=1.0.0
kerberos (additional)pywinrm[kerberos]pypsrp[kerberos]
credssp (additional)pywinrm[credssp]pypsrp[credssp]

Install with pip:

pip3 install "pywinrm>=0.4.0"           # winrm basic/ntlm
pip3 install "pywinrm[kerberos]"         # winrm kerberos
pip3 install "pywinrm[credssp]"          # winrm credssp
pip3 install "pypsrp<=1.0.0"            # psrp basic/ntlm
pip3 install "pypsrp[credssp]<=1.0.0"   # psrp credssp

Windows-Side Setup Required per Auth Type

Basic Auth

Not enabled by default. Enable with PowerShell:

Set-Item -Path WSMan:\localhost\Service\Auth\Basic -Value $true

NTLM

Enabled by default on WinRM — no setup required.

Kerberos

No extra setup on the Windows host. Requires setup on the Ansible controller:

  • Install krb5 system libraries
  • Configure /etc/krb5.conf with your domain
  • Run kinit [email protected] to get a ticket

CredSSP

Not enabled by default. Enable with PowerShell:

Enable-WSManCredSSP -Role Server -Force

Certificate

Requires HTTPS listener + a client certificate mapped to a local Windows user account. See: WinRM Certificate Authentication

Do you want to learn more about Ansible practical use cases? Check the latest book from the author as follows. Available on Packt and Amazon .

Ansible for Real Life Automation

What is Credential Delegation?

Credential delegation means the Windows host can pass your credentials further to a third resource on your behalf — solving the classic double-hop problem.

Ansible Controller → Windows Host → SQL Server / File Share / Another Server
  • Without delegation (Basic, NTLM, Certificate): credentials stop at the Windows host
  • With delegation (Kerberos, CredSSP): credentials can be forwarded to a second hop

CredSSP should only be used when absolutely necessary as it can be a security risk due to its use of unconstrained delegation. — Ansible Docs

NTLM vs Basic — Key Difference

BasicNTLM
How it worksSends username + password (Base64)Challenge-response — password never sent
HTTP (5985)❌ Plaintext credentials⚠️ Message-encrypted but not recommended
HTTPS (5986)✅ TLS wraps credentials✅ TLS + message encryption
Credential exposureDepends entirely on TLSPassword never travels the wire

Appendix

Gineesh Madapparambath

Gineesh Madapparambath

Gineesh Madapparambath is the founder of techbeatly. He is the co-author of The Kubernetes Bible, Second Edition and the author of Ansible for Real Life Automation. He has worked as a Systems Engineer, Automation Specialist, and content author. His primary focus is on Ansible Automation, Containerisation (OpenShift & Kubernetes), and Infrastructure as Code (Terraform). (Read more: iamgini.com)


Note

Disclaimer: The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.

Share :

Related Posts

Ansible

How to Start with Ansible [LIVE]

How to Start with Ansible | techbeatly LIVE Are you an absolute beginner and struggling to start your Ansible journey ? Join us this Sunday 31st Oct, …

Ansible

Ansible Collections [LIVE]

Ansible Collection is a great way of getting content contributions from various Ansible Developers. We will learn what is Ansible Collection and how …

Ansible

Using Ansible with Terraform – Ansible Real Life Series

Learn how to use Ansible with Terraform for provisioning the configurations and software.

Ansible for Windows – Troubleshooting

Ansible for Windows – Troubleshooting

Managing Windows machines using Ansible is pretty straightforward and simple as in the document. You need to configure and enable WinR M on your …

Configure Your Windows Host to be Managed by Ansible

Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he …

Configure Your Windows Host to be Managed by Ansible

Configure Your Windows Host to be Managed by Ansible

I was talking to my friend about Ansible automation and how we are implementing automated solutions for cloud and on-premise infrastructure. Then he …