

It would need (or I would need to be able to provision on to it) a mechanism of SSHing in to the operating system, for Molecule to use to apply and test the role. Looking at the molecule-vagrant docs it become apparent that I would need a virtual machine image in the form of a Vagrant box. Virtualbox can, of course, run a virtual machine which should provide an adequate platform on which to test my Docker role.

One of these drivers, molecule-vagrant, utilises Vagrant which in turn can manage Virtualbox. Unfortunately in this case the role I wanted to test was responsible for managing Docker containers, so there was no easy way to run the role itself within a Docker container without causing some sort of Docker-in-Docker inception!Ī bit more digging in to the Molecule docs confirmed that Molecule utilises various “drivers” to provision the underlying platform to which the role is applied before testing. Reading the Molecule docs this seems to be a fairly straight forward task for the majority of cases, essentially you spin up a Docker container, provision your role and run your tests. The plan was to use Ansible Molecule to apply the role and drive the tests.

I recently decided to write some tests for one of my Ansible roles that I’ve been making a lot of use of.
