How to run and manage Molecule tests for Ansible roles and playbooks. Maintained at: <https://github.com/Cogni-AI-OU/cogni-ai-agent-skills>
# Run Molecule tests
molecule test
# Syntax check
molecule syntax
When running Molecule inside GitHub Codespaces or a repository's VS Code devcontainer:
.venv or venv; use the existing container Python
environment, which should already provide the required dependencies..devcontainer/requirements.txt or
.devcontainer/devcontainer.json instead of introducing a per-run Molecule install step or a separate virtual
environment.If you encounter problems or hangs during molecule test:
molecule create, molecule converge, molecule destroy)
to isolate the issue.timeout 600s molecule create for a max of 5-10 minutes).ANSIBLE_ALLOW_BROKEN_CONDITIONALS=1 environment variable
(e.g., timeout 600s env ANSIBLE_ALLOW_BROKEN_CONDITIONALS=1 molecule create).requests or docker is installed for the main container
Python but Ansible still cannot import it, check ansible --version to identify the interpreter in use. In
Codespaces/devcontainers, Ansible may run from a pipx-managed environment, so install controller-side libraries there as
well, for example with pipx inject ansible -r .devcontainer/requirements-ansible.txt.Note that this file should be updated if outdated or steps/examples are not working.