Molecule Plugins is a monorepository containing various drivers for the Molecule Ansible testing framework, including Azure, Docker, EC2, GCE, OpenStack, Podman, and Vagrant. It centralizes the development and maintenance of these plugins to ensure compatibility and reduce overhead. Molecule itself is an Ansible testing framework designed for developing and testing Ansible collections, playbooks, and roles. The library is actively maintained with a CalVer release cadence, with the current version being 25.8.12.
pip install 'molecule-plugins[docker]' 'molecule-plugins[podman]' # or other drivers like azure, ec2, gce, openstack, vagrantNo compatibility data collected yet for this library.
This quickstart demonstrates how to set up an Ansible role with a Molecule test scenario using the Docker driver. After initializing the role and scenario, you can customize the `molecule.yml` to define your test platforms and then execute the tests.
Before installing `molecule-plugins`, run `pip uninstall molecule-docker molecule-azure ...` for any previously installed individual driver packages.
Replace `molecule init role <name>` with `ansible-galaxy role init <name>` to create the role structure, then navigate into the role and use `molecule init scenario <name>`.
Always install `molecule-plugins` with the specific driver extras you intend to use, e.g., `pip install 'molecule-plugins[docker]'`.
Upgrade `molecule-plugins` to v23.6.0 or newer. If unable to upgrade, workarounds might include directly using `vagrant ssh <id>` for Vagrant or checking specific driver documentation for alternatives.
Consult the Ansible Molecule documentation regarding SELinux considerations. Potential workarounds might involve specific SELinux policy adjustments or installing system-wide (though virtual environments are generally recommended).
Install the specific driver with its extras, for example: `pip install 'molecule-plugins[docker]'` or `pip install 'molecule-plugins[podman]'`. Ensure any previous standalone driver packages (e.g., `molecule-docker`) are uninstalled.
Ensure `molecule-plugins`, `molecule`, and `ansible-core` are compatible versions and all necessary Python dependencies (like `python-vagrant` for the vagrant driver) are installed within a virtual environment. Upgrading or downgrading specific packages might be necessary, e.g., `pip install -U molecule-plugins[vagrant] 'molecule<6'` or checking for latest compatible versions as per `molecule` and `ansible-core` release notes.
Explicitly install the Docker driver with its extras: `pip install 'molecule-plugins[docker]'`. Verify Docker is installed and running on your system, and your user has the necessary permissions (e.g., in the 'docker' group).
The `lint` command was removed from Molecule 5.0.0. Update your `molecule.yml` to invoke `ansible-lint` (or other linting tools) as a command within the `provisioner` or `verifier` section, or remove any calls to `molecule lint` from your workflow, as linting is now typically handled via `ansible-lint` directly.