Running Ansible playbooks against Windows and testing with Pester
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Ansible / Test-Kitchen / Windows / Pester

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:

Setup your workstation

I HIGHLY recommend using chefdk and its version of Ruby, especially on Windows platforms.

Install the following:

  • ChefDK
  • Vagrant
  • VirtualBox

Install required Ruby gems

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

Run test-kitchen

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.