Using Ansible to manage Windows, many of the syntax and rules that apply for Unix/Linux hosts also apply to Windows. Still, there are some differences when it comes to components like path separators and OS-specific tasks. This document covers details specific to using Ansible for Windows.
How does it Work
Ansible manages Linux/Unix machines using SSH by default.
Starting in version 1.7, Ansible contains support for managing Windows machines. This uses native PowerShell remoting, rather than SSH.
Ansible will still be run from a Linux control machine and uses the "winrm" Python module to talk to remote hosts. While not supported by Microsoft or Ansible, this Linux control machine can be a Windows Subsystem for Linux (WSL) bash shell.
No additional software needs to be installed on the remote machines for Ansible to manage them, and it still maintains the agentless properties that make it popular on Linux/Unix.
Note that it is important you have a basic understanding of Ansible, so if you haven't written a Linux playbook first, it might be difficult to you.
Linux like Linux, Windows like Windows
Users prefer Ansible as a simple, agentless, powerful automation tool that allows them to model and deliver any configuration, deployment, and environment across their IT infrastructure.
Ansible knew that the key was to bring the same simple, agentless paradigm to managing Windows, while still feeling native to Windows administrators. Ansible native Windows support uses Windows PowerShell remoting to manage Windows like Windows in the same Ansible agentless way that Ansible manages Linux like Linux.
With Ansible's native Windows supports:
You can connect and automate Windows using local or domain users, and you will be able to use Windows 'runas' support to execute actions as the Administrator, just like 'sudo' or 'su' on Linux.
You can write your modules in PowerShell with easy extensibility of Ansible. And extend Ansible for whatever other functionality you need. Ansible users have written modules for managing to file system ACLs, managing Windows Firewall, managing hostname, domain membership, and more.