Registry / devops / molecule-plugins

molecule-plugins

JSON →
library25.8.12pypypiunverified

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, vagrant
INSTALL
IMPORT
SIG · MOLECULE-PLUGINS
M
molecule-plugins
devopspythonv25.8.12
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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.

# 1. Initialize an Ansible role (since Molecule 6.0.0, use ansible-galaxy init) ansible-galaxy role init my_ansible_role cd my_ansible_role # 2. Initialize a Molecule scenario (e.g., with docker driver) # A molecule.yml file will be created in molecule/default molecule init scenario default --driver-name docker --verifier-name ansible # 3. Modify molecule/default/molecule.yml if needed (e.g., specify platform image) # Example snippet for molecule/default/molecule.yml: # platforms: # - name: instance # image: 'docker.io/pycontribs/centos:8' # pre_build_image: true # 4. Run tests for the default scenario molecule test --all
molecule --version
Debug
Known issues
breakingWhen migrating from individual driver packages (e.g., `molecule-docker`, `molecule-azure`) to `molecule-plugins`, you *must* uninstall the old standalone packages first. Failing to do so will result in a broken setup due to multiple plugins registering the same entry points.
fix
Before installing `molecule-plugins`, run `pip uninstall molecule-docker molecule-azure ...` for any previously installed individual driver packages.
affects: All versions migrating from standalone drivers
breakingThe `molecule init role` command was removed in Molecule version 6.0.0. To initialize an Ansible role, use `ansible-galaxy role init` instead.
fix
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>`.
affects: Molecule >= 6.0.0
gotchaInstalling `molecule-plugins` alone does not install the underlying tools or Python libraries required by each driver (e.g., Docker daemon, Podman, Vagrant, `community.docker` Python collection, `python-vagrant`). These must be installed by specifying extras, for example, `pip install 'molecule-plugins[docker]'`.
fix
Always install `molecule-plugins` with the specific driver extras you intend to use, e.g., `pip install 'molecule-plugins[docker]'`.
affects: All versions
gotchaFor `molecule-plugins` versions prior to v23.6.0, the `molecule login --host <hostname>` command might not work correctly, potentially due to issues with port templating.
fix
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.
affects: < 23.6.0
gotchaOn SELinux-enabled systems, installing Molecule or its plugins into a virtual environment may lead to issues (e.g., issue 34340), even if SELinux is not explicitly enabled or is in permissive mode.
fix
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).
affects: All versions on SELinux systems
Errors
Common errors & fixes
CRITICAL Failed to find driver [driver_name]. Please ensure that the driver is correctly installed.
The specific Molecule driver (e.g., docker, podman, vagrant) and its required dependencies were not installed using the 'extras' syntax, or the driver's Python package is missing.
fix
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.
ModuleNotFoundError: No module named 'ansible.module_utils.common.yaml'
This usually indicates a version incompatibility between `molecule-plugins`, `molecule`, and `ansible-core`, or a missing dependency in the environment, particularly affecting older `ansible.module_utils` imports.
fix
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.
KeyError: 'docker'
This error typically occurs when the `molecule-plugins[docker]` package is not correctly installed or recognized by Molecule, even if the base `molecule` package is present. It implies the driver is not properly registered or its underlying Python dependencies for Docker are not met.
fix
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).
AttributeError: module 'molecule.command' has no attribute 'lint'. Did you mean: 'list'?
This error signifies a breaking change in Molecule's API, where the direct `lint` command or its corresponding attribute was removed or refactored in Molecule 5.x and later versions.
fix
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.
Upgrade
Version history
25.8.12latest on PyPI · released Aug 12, 2025
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer.
molecule>=5.0.0requiredMolecule Plugins requires Molecule core version 5 or newer.
ansible-core>=2.12requiredMolecule and its plugins are used for testing Ansible content.
community.dockeroptionalRequired for the Docker driver; installed via 'molecule-plugins[docker]'.
python-vagrantoptionalRequired for the Vagrant driver; installed via 'molecule-plugins[vagrant]'.
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
molecule-plugins — pip install molecule-plugins · libregistry