Registry / devops / molecule-docker

molecule-docker

JSON →
library2.1.0pypypiunverified

Molecule Docker is a driver plugin for Molecule, the Ansible role testing framework. It allows users to test their Ansible roles against Docker containers, providing a lightweight and isolated environment for development and testing. The current version is 2.1.0, and it follows Molecule's release cadence, with major releases aligning with Molecule's major versions and frequent bugfix/minor updates.

pip install molecule-docker
INSTALL
IMPORT
SIG · MOLECULE-DOCKER
M
molecule-docker
devopspythonv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

To quickly get started, create a `molecule/default/molecule.yml` file and a `molecule/default/converge.yml` file as shown. This configuration specifies the `docker` driver, uses a `pycontribs/centos:8` image, and runs a basic Ansible ping task. After saving these, navigate to the `molecule/default` directory and run `molecule test`.

# molecule/default/molecule.yml --- dependency: name: galaxy driver: name: docker platforms: - name: instance image: "docker.io/pycontribs/centos:8" pre_build_image: true provisioner: name: ansible playbooks: converge: converge.yml verifier: name: ansible # molecule/default/converge.yml --- - name: Converge hosts: instance tasks: - name: "Check ping" ansible.builtin.ping
Debug
Known issues
breakingMolecule Docker v2.0.0 introduced significant breaking changes, requiring Molecule 4.0.0+, Ansible Core 2.12.0+, and dropping Python 3.6/3.7 support. Ensure your entire environment is updated.
fix
Upgrade Molecule to 4.x, Ansible Core to 2.12.x+, and use Python 3.8+.
affects: >=2.0.0
breakingThe `community.docker` Ansible collection is a mandatory runtime dependency for `molecule-docker` 1.0.1 and newer. Specifically, v2.0.0 requires `community.docker>=3.0.0a2`.
fix
Install the collection using `ansible-galaxy collection install community.docker` and ensure it meets the minimum version requirement.
affects: >=1.0.1
gotchaMolecule Docker versions 0.3.3 and 0.3.4 were yanked from PyPI due to major regressions. Users should avoid these specific versions.
fix
Upgrade to a newer stable release like 1.0.1 or 2.1.0, or pin to an older stable version if necessary.
affects: 0.3.3, 0.3.4
gotchaOlder `molecule-docker` versions (pre-1.0.1) relied on a different Ansible collection or direct modules. Ensure you're using `community.docker` for modern setups.
fix
Upgrade to `molecule-docker` 1.0.1 or newer and install `community.docker`.
affects: <1.0.1
Errors
Common errors & fixes
The driver "docker" requires Molecule v4.0.0 or newer. Found v3.x.x.
Your installed version of Molecule is too old for molecule-docker 2.x.
fix
Upgrade Molecule: `pip install --upgrade molecule`.
Ansible requires ansible-core version >= 2.12.0. Current version is 2.11.x.
Your installed version of ansible-core is too old for molecule-docker 2.x.
fix
Upgrade ansible-core: `pip install --upgrade ansible-core`.
ERROR! The specified collection 'community.docker' was not found in any of the configured collection paths.
The `community.docker` Ansible collection, which is required by the docker driver, is not installed.
fix
Install the collection: `ansible-galaxy collection install community.docker`.
Unable to find image 'docker.io/pycontribs/centos:8' locally
The specified Docker image in your `molecule.yml` does not exist locally and Docker failed to pull it.
fix
Ensure Docker is running and has internet access. Manually pull the image with `docker pull docker.io/pycontribs/centos:8` to diagnose network issues, or correct the image name in `molecule.yml`.
Upgrade
Version history
2.1.0latest on PyPI · released Sep 29, 2022
Audit
Dependencies
moleculerequiredCore Molecule framework, version 4.0.0 or newer is required for molecule-docker >= 2.0.0
ansible-corerequiredAnsible engine, version 2.12.0 or newer is required for molecule-docker >= 2.0.0
community.dockerrequiredAnsible collection providing Docker modules, version 3.0.0a2 or newer is required for molecule-docker >= 2.0.0
pythonrequiredPython runtime, version 3.8 or newer
Agent activity
1 hits · last 30 days
ahrefsbot
1
Resources
molecule-docker — pip install molecule-docker · libregistry