This role is an example role for using test-kitchen
on ansible roles that is meant to run on Windows hosts.
We use AWS EC2 to deploy the machines,
- main - Downloading and Installing Google Chrome on the target machine.
- This role does not require any variables.
- This role has no outputs.
- This role does not have any dependencies.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
# Assuming that you have some machines in 'jmeter' hosts group
- hosts: tag_kitchen_type_windows
gather_facts: no
tasks:
- include_role:
name: ansible_test_kitchen_windows_role
We use Test-Kitchen for testing ansible roles that was meant to run on Windows hosts.
- Install ChefDK
- Install
chef
gems:$ chef gem install 'kitchen-ansible'
$ chef gem install 'winrm'
$ chef gem install 'winrm-fs'
$ chef gem install 'kitchen-pester'
- Copy
.kitchen.yml
to.kitchen.local.yml
, edit and override per your needs (instance profile, subnet, keypair, etc). - Run
$ kitchen create
and take note of the windows machine that was created. - Make sure that the following files are executable (by running
chmod +x file
):$ chmod +x inventory/generate_inventory.sh
$ chmod +x inventory/ec2.py
- Update the hosts file on the ansible inventory running
$ ./inventory/generate_inventory.sh
from the root of the repository - Run
$ kitchen converge
to run the default playbook from the provisioned ansible machine on the windows host. - Run
$ kitchen verify
for running pester tests. - Run
$ kitchen destroy
to terminate instances.
BSD
Avishay Bar, Cloud Initiatives team, CyberArk 2018