bedkillerspacex-boop/codex-skill-library/ansible-role-testing

Claude Code and agent skill by bedkillerspacex-boop/codex-skill-library

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Test Ansible roles with molecule/docker (or podman), idempotence, ansible-lint, and secret-safe fixtures for owned automation repos. Use when adding CI for roles, verifying converge/idempotence/verify, or preventing regressions before production apply.

Install

npx vskill@latest install bedkillerspacex-boop/codex-skill-library/ansible-role-testing

SKILL.md

The same SKILL.md was published earlier as bedkillerspacex-boop/codex-skill-library/ansible-role-testing.

Ansible Role Testing

Scope And Authorization

  • In scope: Ansible roles/collections in repos you own; molecule against disposable containers/VMs.
  • Out of scope: Pointing molecule at production inventory; using real prod secrets in CI logs.
  • Prefer containers for unit-like role tests; use staging for full integration.
  • Pair with ansible-vault-usage and code-quality-standards.

When To Use

  • Creating or refactoring an Ansible role.
  • Adding GitHub Actions/GitLab CI for molecule test / ansible-lint.
  • Proving idempotence (second converge changes 0).
  • Catching template/handler regressions.

Do Not Use As Primary

NeedSkill instead
Vault encrypt/decrypt workflowsansible-vault-usage
Org secrets programsecrets-management-hygiene
General Linux hardening contentlinux hardening skills
Implementation quality baselinecode-quality-standards

Domain Focus

StagePurpose
ansible-lintStatic best practices
molecule createSpin test instance
convergeApply role
idempotenceRe-apply; expect no changes
verifyAssert state (testinfra/goss)
destroyCleanup

Workflow

1. Confirm role and success criteria
  1. Record role path, supported platforms (EL9, Ubuntu 22.04, …), required privileges.
  2. Success: lint clean; molecule test green on listed platforms; no secrets in repo; idempotent.
  3. List dependencies (roles/collections).
2. Scaffold molecule (if missing)
bash
cd roles/my_role
molecule init scenario -r my_role # or collection-aware workflow
yaml
# molecule/default/molecule.yml (illustrative)
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: geerlingguy/docker-ubuntu2204-ansible
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
3. Write converge and verify
yaml
# molecule/default/converge.yml
- name: Converge
hosts: all
roles:
- role: my_role
yaml
# molecule/default/verify.yml
- name: Verify
hosts: all
tasks:
- name: Check service
ansible.builtin.command: systemctl is-active myapp
changed_when: false
4. Secrets in tests
  1. Use dummy passwords in molecule fixtures — never prod vault files.
  2. If role requires vault, inject CI secret via env and ANSIBLE_VAULT_PASSWORD_FILE pointing to temp file with mode 600.
  3. Assert role fails closed when secrets missing if that is desired behavior.
5. Run locally and in CI
bash
ansible-lint roles/my_role
cd roles/my_role && molecule test
# Idempotence alone:
molecule converge && molecule idempotence
yaml
# CI sketch
- run: pip install ansible ansible-lint molecule molecule-plugins[docker]
- run: ansible-lint
- run: molecule test
6. Multi-platform matrix
  1. Add platforms for each supported OS image.
  2. Skip tags with molecule converge -- --skip-tags slow only when documented.
  3. Fail CI on any platform in the support matrix.
7. Hand off
  1. Document how to run molecule; required collections in requirements.yml.
  2. Badge/CI required on PRs touching role.
  3. Production apply still needs change window — tests reduce risk, not replace judgment.

Good / Bad

TopicGoodBad
TargetEphemeral containersProd hosts as molecule driver
IdempotenceEnforced in CI“Run twice manually sometimes”
SecretsDummy valuesReal prod vault in git
VerifyAssertions on stateConverge-only smoke

Output Checklist

  • [ ] Platforms and role path documented
  • [ ] ansible-lint clean
  • [ ] molecule scenario present
  • [ ] converge + idempotence + verify green
  • [ ] No real secrets in fixtures
  • [ ] CI wired for PRs
  • [ ] Collection deps pinned
  • [ ] code-quality-standards applied

Rules

  • Owned automation only; never test against unapproved fleets.
  • Prefer disposable infrastructure for molecule.
  • Idempotence is part of the contract.
  • Keep vault passwords out of logs.
  • Lint + molecule before production apply.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/bedkillerspacex-boop/codex-skill-library/ansible-role-testing/badge)](https://verified-skill.com/skills/bedkillerspacex-boop/codex-skill-library/ansible-role-testing)

Something wrong with this skill or its page? Tell us.