Test your ansible roles against various platforms
This provides a bootstrap for the test kitchen framework in corporation with vagrant and ansible. These are some of the following:
For installing the required gems:
gem install bundler
bundle install
For installing the required roles:
ansible-galaxy install -r requirements.yml --roles-path=./roles
The .kitchen.yml
file is the entry point for all Kitchen CLI commands, here are the commands that you need:
kitchen list
- Lists all the images(docker) or plaforms(Vagrant VMs) that are specified in the .kitchen.yml file.kitchen create <platform>
or kitchen create
- Creates a temporary VM that can be viewed in VirtualBox or a temporary docker image, on which the infrastructure tests will be carried out. kitchen converge <platform>
or kitchen converge
- Converge is used to run the playbook or cookbook against which you are testing the infrastructure, it basically runs the playbook/cookbook on that machine. kitchen verify <platform>
or kitchen verify
- Verify tests your converged infrastructure against a test suite. Test suite contains the inspec tests that check if infrastructure is correctly built for a platformkitchen test <platform>
or kitchen test
- This step destroys, creates, converges and verifies a VM.kitchen login <platform>
- To go inside a platform( or ssh to a box in real scenario), you can simply login using this.kitchen destroy <platform>
or kitchen destroy
- Removes the VM or image from historyNOTE - If you specify platforms in these commands, they run only for the mentioned platform. Otherwise, they run for all platforms in the .kitchen.yml.