When you have developed some playbooks and roles with Ansible the side effect is that you may feel that development begins to move a bit slower as you manually take the time to verify variable permutations.

When you find yourself in this situation, it’s time to start testing. Here’s how to get started by using Docker and Ansible to automatically test your Ansible roles.

Deep Dive Note:

Base distro Docker images don’t normally come with ssh running. Nor do they have their init systems enabled. We are going to use the following dockerfiles hacked together Dockerfile(s) for centos6/7 and Ubuntu 12.04 (14.04 just works 🙂 to run ssh and the init system. Enough to ensure Ansible service module works against them and they can be sshed into

chrismeyers/centos6

chrismeyers/centos7

chrismeyers/ubuntu12.04

ubuntu-upstart:14.04

The default login is root / docker.io

This playbook brings up one host with Ubuntu 14.04 LTS, connects to the created host(s), and install a Minecraft server.