Ansible and Windows

How PowerShell enables a Linux configuration manager to work in a Windows world

Paul Broadwith

Paul Broadwith

Paul Broadwith

Technical Engineering Manager at Chocolatey Software, Inc.

  • Glasgow, Scotland
  • 30 years in IT in many different sectors

MVP Logo
Chocolatey Logo
Microsoft Certified Trainer Logo


  • The TL;DR History of Ansible.
  • Ansible infrastructure.
  • How Ansible works on Windows …. is it maybe … PowerShell?
  • DEMO: Writing an Ansible Windows module.
  • Questions?

The TL;DR History of Ansible

  • February 2012

    First Ansible code written by Michael DeHaan.

  • March 2013

    AnsibleWorks was born.

  • January 2014

    AnsibleWorks becomes Ansible.

  • August 2014

    Ansible 1.7 released with Windows Beta support.

  • October 2015

    Red Hat buys Ansible.

  • July 2019

    IBM buys Red Hat for $34B.

By <>, Fair use, <>


Was coined by Ursula K. Le Guin and used in her book ‘Rocannon’s World’ published in 1966.

It describes an ‘answerable device’ or ‘instantaneous communication systems’

Ansible Infrastructure

%%{init: {'theme': 'default', 'themeVariables': { 'fontSize': '25px'}} }%% flowchart LR collections(("Ansible Galaxy
Collections")) -.-> config subgraph sgcomponents ["Ansible Control Node running on Linux"] components>Playbooks
] -.-> config{"Ansible Config"} inventory>Inventory
Local, Cloud or CMDB] -.-> config end sgcomponents -- SSH ----> linuxclients["Linux Hosts
(agentless)"] sgcomponents -- WinRM / OpenSSH ----> winclients["Windows Hosts
(agentless)"] sgcomponents -- SSH / API ----> networking["Networking
(agentless)"] sgcomponents -- API ----> cloud["Cloud Services"] classDef green fill:#9f6,stroke:#333,stroke-width:2px; classDef orange fill:#f96,stroke:#333,stroke-width:4px; classDef blue fill:#9cbacc,stroke:#333,stroke-width:2px class dis blue

How Does Ansible Work on Windows?

Ansible has the following minimum requirements for Windows hosts:

  • Windows Server 2012 / Windows 8.1
  • PowerShell 3.0
  • .NET 4.0
  • WinRM configured and listening

Ansible Control node cannot run on a Windows host natively.

Options to run Ansible Control node on Windows:

  • Windows Subsystem for Linux
  • Linux Virtual Machine
  • Docker container
  • Cygwin (not officially supported)

Whatever you use, Python 3.8 and the pywinrm module is required.

Writing Your First Windows Ansible Module

  • Code is in the PowerShell script, documentation in the Python script
  • Don’t use Write-Host / Debug / Verbose / Error
  • Exceptions / Errors can be returned back to Ansible
  • Can specify minimum PowerShell or OS requirements
  • Modules are run under StrictMode version 2


  • We know the TL;DR history of Ansible.
  • We understand Ansible infrastructure.
  • We know how Ansible works on Windows and how it does not run as a control node on Windows.
  • We know how Windows Ansible modules are structured.


Paul Broadwith