Caddy
A web server and reverse proxy with automatic HTTPS.
Test your Ansible roles and collections in throwaway containers or VMs.
No votes yet. Tried it? Be the first to say.
One vote per person. No account needed.
Molecule spins up instances, applies your role, checks idempotence, runs verification tests and tears everything down. It turns "I think this playbook works" into a repeatable test you can run in CI.
Running playbooks against a shared dev box and hoping
You maintain Ansible roles that more than one machine or person depends on.
Each test setup lives in molecule/<scenario>/ with its own molecule.yml, so you can test a role against several distros or configurations.
dependency, create, prepare, converge, idempotence, verify and destroy, run in order by molecule test.
Runs your role a second time and fails if anything reports "changed", which catches the most common Ansible bug.
Docker and Podman (via molecule-plugins), delegated or custom drivers for VMs and cloud instances.
Write checks as an Ansible playbook (the default) or use Testinfra (pytest) assertions.
molecule converge and molecule login let you apply changes and poke around without a full teardown.
molecule test creates fresh instances (for example Docker containers built from images you choose), runs any prepare playbook, applies your role with the converge playbook, applies it again to prove idempotence, runs your verify checks, and finally destroys everything. Each step is also available on its own, which is what makes the development loop fast.
pip install molecule "molecule-plugins[docker]" ansible-core
cd roles/my_role
molecule init scenario --driver-name docker# molecule/default/molecule.yml
driver:
name: docker
platforms:
- name: ubuntu
image: geerlingguy/docker-ubuntu2204-ansible
pre_build_image: true
- name: rocky
image: geerlingguy/docker-rockylinux9-ansible
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible# molecule/default/verify.yml
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Nginx package is installed
ansible.builtin.package:
name: nginx
state: present
check_mode: true
register: pkg
failed_when: pkg.changedmolecule converge # apply the role (re-run after each edit)
molecule login # shell into an instance to inspect it
molecule verify # run your checks
molecule test # the full clean-room run, as in CI
molecule destroy # clean upmolecule test to your CI matrix per scenario, so a failure tells you exactly which platform broke.converge during development and test in CI.init commands; many older tutorials and blog posts are out of date.pip install molecule "molecule-plugins[docker]" ansible-core
cd my-role
molecule init scenario --driver-name docker
molecule test Ansible's own tool for sanity, unit and integration tests of collections; complementary to Molecule.
The Chef-world equivalent, also usable with Ansible.
Real VMs, but no structured lifecycle or idempotence checks.
Other tools that share topics with Molecule.
A web server and reverse proxy with automatic HTTPS.
Test and compare LLM prompts and models with assertions, locally or in CI.
A terminal UI for watching and managing Kubernetes clusters.