Skip to content

My experiment with using Test Kitchen and Kitchen Ansible extension to set up automated testing for Ansible roles in Docker.

Notifications You must be signed in to change notification settings

m1g0r/test-kitchen-ansible

Repository files navigation

Testing an Ansible role using Test Kitchen

My experiment with using Test Kitchen and Kitchen Ansible extension to set up automated testing for Ansible roles in Docker.

Requirements

Dependencies

Available platforms:

  • ubuntu-16.04
  • ubuntu-18.04
  • ubuntu-20.04
  • centos-7
  • centos-8

Getting Started

To create pipenv environment and install all of these we use bundle install

make init

Check all available options:

invoke --list

Start test platforms

Show a list of supported platforms

invoke kitchen.list

Manually start test one of the platform

invoke kitchen.create ubuntu-1604 playbook.yml

If error: "Message: Could not parse Docker build output for image ID"

export DOCKER_BUILDKIT=0

Then start test platforms

Manually run Ansible playbook on the test platforms

invoke kitchen.converge ubuntu-1604 playbook.yml

Manually delete all test platforms

invoke kitchen.destroy

Alternately you can run the command below:

invoke kitchen.test ubuntu-1604 playbook.aml

It will run create, converge, verify and destroy in sequence and you can just chill, watch the logs and enjoy your fantastic Ansible Role!

About

My experiment with using Test Kitchen and Kitchen Ansible extension to set up automated testing for Ansible roles in Docker.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published