Ansible, Windows and PowerShell: the Basics - Introduction
Back in June of this year I presented a session at PowerShell Southampton on using Ansible and PowerShell together. There was a fair amount of interest in this topic both at the event and online afterwards, so I decided to follow it up here with a series of posts looking at the basics for someone getting started with Ansible. In particular using it to automate and configure Windows, where to use PowerShell for that task and sometimes where not to if there is native functionality already available within Ansible.
First of all the presentation from that evening can be found below:
https://www.slideshare.net/jonathanmedd/using-ansible-and-powershell-together
The best place to start with this topic I found was the Ansible documentation for Windows modules. Looking at the list on this page gives a very good indication of what is possible for Windows natively in Ansible, i.e. what you will not need to use your own PowerShell code for.
You can follow through the link to each module and you will typically find excellent examples on how to use it and definitions of each parameter accepted.
The source code for each of the Windows Modules is available on GitHub, so it is possible to dig further to see how they work and also to contribute if you wish to make an improvement or fix.
Most of these modules are using PowerShell to carry out their tasks, so effectively you are using PowerShell in Ansible when using one of these modules, however it saves you the effort of needing to write the code yourself.
In subsequent posts in this series, we will look at some practical examples using Ansible, Windows and PowerShell.
- Ansible, Windows and PowerShell: the Basics – Introduction
- Ansible, Windows and PowerShell: the Basics - Part 1, Windows Services
- Ansible, Windows and PowerShell: the Basics – Part 2, Install PowerShell Modules
- Ansible, Windows and PowerShell: the Basics – Part 3, Windows Roles and Features
- Ansible, Windows and PowerShell: the Basics – Part 4, Invoking PowerShell Code
- Ansible, Windows and PowerShell: the Basics – Part 5, Example PowerShell Error Handling
- Ansible, Windows and PowerShell: the Basics – Part 6, Displaying Output from PowerShell Code
- Ansible, Windows and PowerShell: the Basics – Part 7, Utilising PowerShell DSC
- Ansible, Windows and PowerShell: the Basics – Part 8, Rebooting & Waiting
- Ansible, Windows and PowerShell: the Basics – Part 9, Disk Creation
- Ansible, Windows and PowerShell: the Basics – Part 10, Local Users
- Ansible, Windows and PowerShell: the Basics – Part 11, Local Groups
- Ansible, Windows and PowerShell: the Basics – Part 12, Set TimeZone
- Ansible, Windows and PowerShell: the Basics – Part 13, Environment Variables
- Ansible, Windows and PowerShell: the Basics – Part 14, Registry Entries
- Ansible, Windows and PowerShell: the Basics – Part 15, Install Chocolatey Packages