This repository is an example of how you can test Ansible roles meant for Windows machines using test-kitchen.
The process will build an Ansible server as part of a test-kitchen run, apply configuration to a Windows node and then tests via Pester.
You can read a detailed blog post about this:
https://hodgkins.io/testing-ansible-roles-windows-test-kitchen
I HIGHLY recommend using chefdk and its version of Ruby, especially on Windows platforms.
Install the following:
- ChefDK
- Vagrant
- VirtualBox
Before starting we need to install some Ruby gems.
# enter the kitchen directory
cd kitchen
# use bundler to install the gems
chef exec bundle install
With everything installed we can start using test-kitchen.
# enter the kitchen directory
cd kitchen
# create the vms
# on windows you may get a UAC prompt when virtualbox initially configures networking
kitchen create
# apply the ansible role to the windows server
kitchen converge
# run the tests against the windows server
kitchen verify
# delete the vms
kitchen destroy
I am using Scrutinizer CI to lint the role. See .scrutinizer.yml
.