molecule

Run and manage Molecule tests for Ansible roles and playbooks.

3|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill molecule
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: molecule
Source: https://github.com/Cogni-AI-OU/cogni-ai-agent-skills/tree/main/molecule
Command: npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill molecule

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Molecule is used to validate Ansible roles and playbooks, but running it reliably across devcontainers and Codespaces can be confusing and may cause hangs or missing-dependency issues.

Core Features & Use Cases

  • Local Ansible role validation: Run Molecule to execute syntax, converge, and test cycles for roles and playbooks before publishing changes.
  • Devcontainer/Codespaces-friendly workflows: Ensure controller dependencies are installed in the devcontainer configuration rather than during each Molecule run.
  • Hang-resistant troubleshooting: Diagnose Molecule testing problems by splitting create/converge/destroy steps and using timeouts to prevent indefinite execution.

Quick Start

Use the molecule skill to run Molecule syntax checks for your Ansible role locally in the controller environment.

Frequently Asked Questions about molecule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Molecule tests for Ansible roles without causing hangs?

To run Molecule tests without causing hangs, split the create, converge, and destroy steps into separate subcommands and apply execution timeouts. This prevents indefinite execution during the Ansible validation cycle.

Why does Molecule hang or miss dependencies in Codespaces and devcontainers?

Molecule hangs or misses dependencies in Codespaces and devcontainers when controller packages are installed during each run. You must configure all required controller dependencies directly in the devcontainer configuration.

What is the best way to troubleshoot interpreter or module mismatches in Molecule?

The best way to troubleshoot interpreter or module mismatches in Molecule is to run isolated molecule subcommands safely and apply the optional ANSIBLE_ALLOW_BROKEN_CONDITIONALS setting to bypass broken conditionals.

Do I need a separate virtualenv to run Molecule tests locally?

You do not need a separate virtualenv to run Molecule tests locally. You should avoid per-run controller installs and extra virtualenvs, relying instead on the existing controller environment for validation.

Can I execute Ansible playbook syntax checks using Molecule subcommands?

You can execute Ansible playbook syntax checks using specific molecule subcommands. This allows you to validate syntax, run converge cycles, and test roles locally before publishing changes.