My experiment with using Test Kitchen and Kitchen Ansible extension to set up automated testing for Ansible roles in Docker.
- ubuntu-16.04
- ubuntu-18.04
- ubuntu-20.04
- centos-7
- centos-8
To create pipenv environment and install all of these we use bundle install
make init
Check all available options:
invoke --list
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
invoke kitchen.converge ubuntu-1604 playbook.yml
invoke kitchen.destroy
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!