Vie. May 24th, 2024

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 /

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

Source code available here:


Install Docker:

Install Ansible:


$ ansible-galaxy install yauh.java8
$ ansible-galaxy install provision_docker

$ ansible-docker juanvicente.herrera$ ansible-playbook  test.yml


Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *