akin-ozer/cc-devops-skills65 files

Ansible Validator

Validate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks.

Specification
Skill ID
akin-ozer/cc-devops-skills/ansible-validator
Publisher
akin-ozer
Repository
cc-devops-skills
Installs
0
Files
65
Synced
Sep 23, 2026
How to use it

Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.

akin-ozer/cc-devops-skills/ansible-validatorInstalls these files
  • .gitignore
  • SKILL.md
  • assets/.ansible-lint
  • assets/.yamllint
  • assets/molecule.yml.template
  • references/best_practices.md
  • references/common_errors.md
  • references/module_alternatives.md
  • references/security_checklist.md
  • scripts/check_fqcn.sh
  • scripts/extract_ansible_info.py
  • scripts/extract_ansible_info_wrapper.sh
  • scripts/scan_secrets.sh
  • scripts/setup_tools.sh
  • scripts/test_role.sh
  • scripts/validate_inventory.sh
  • scripts/validate_playbook.sh
  • scripts/validate_playbook_security.sh
  • scripts/validate_role.sh
  • scripts/validate_role_security.sh
  • test/README.md
  • test/inventory/localhost-nested.yml
  • test/playbooks/bad-playbook.yml
  • test/playbooks/good-playbook.yml
  • test/playbooks/regression-inline-fqcn.yml
  • test/playbooks/regression-mixed-import.yml
  • test/roles/geerlingguy.mysql/.ansible-lint
  • test/roles/geerlingguy.mysql/.github/FUNDING.yml
  • test/roles/geerlingguy.mysql/.github/workflows/ci.yml
  • test/roles/geerlingguy.mysql/.github/workflows/release.yml
  • test/roles/geerlingguy.mysql/.github/workflows/stale.yml
  • test/roles/geerlingguy.mysql/.gitignore
  • test/roles/geerlingguy.mysql/.yamllint
  • test/roles/geerlingguy.mysql/LICENSE
  • test/roles/geerlingguy.mysql/README.md
  • test/roles/geerlingguy.mysql/defaults/main.yml
  • test/roles/geerlingguy.mysql/handlers/main.yml
  • test/roles/geerlingguy.mysql/meta/main.yml
  • test/roles/geerlingguy.mysql/molecule/default/converge.yml
  • test/roles/geerlingguy.mysql/molecule/default/molecule.yml
  • test/roles/geerlingguy.mysql/tasks/configure.yml
  • test/roles/geerlingguy.mysql/tasks/databases.yml
  • test/roles/geerlingguy.mysql/tasks/main.yml
  • test/roles/geerlingguy.mysql/tasks/replication.yml
  • test/roles/geerlingguy.mysql/tasks/secure-installation.yml
  • test/roles/geerlingguy.mysql/tasks/setup-Archlinux.yml
  • test/roles/geerlingguy.mysql/tasks/setup-Debian.yml
  • test/roles/geerlingguy.mysql/tasks/setup-RedHat.yml
  • test/roles/geerlingguy.mysql/tasks/users.yml
  • test/roles/geerlingguy.mysql/tasks/variables.yml
  • test/roles/geerlingguy.mysql/templates/my.cnf.j2
  • test/roles/geerlingguy.mysql/templates/root-my.cnf.j2
  • test/roles/geerlingguy.mysql/templates/user-my.cnf.j2
  • test/roles/geerlingguy.mysql/vars/Archlinux.yml
  • test/roles/geerlingguy.mysql/vars/Debian-10.yml
  • test/roles/geerlingguy.mysql/vars/Debian-11.yml
  • test/roles/geerlingguy.mysql/vars/Debian-12.yml
  • test/roles/geerlingguy.mysql/vars/Debian-13.yml
  • test/roles/geerlingguy.mysql/vars/Debian.yml
  • test/roles/geerlingguy.mysql/vars/RedHat-10.yml
  • test/roles/geerlingguy.mysql/vars/RedHat-7.yml
  • test/roles/geerlingguy.mysql/vars/RedHat-8.yml
  • test/roles/geerlingguy.mysql/vars/RedHat-9.yml
  • test/roles/geerlingguy.mysql/vars/Ubuntu.yml
  • test/test_regressions.sh

What this skill tells the agent

Ansible Validator

Overview

Comprehensive toolkit for validating, linting, and testing Ansible playbooks, roles, and collections. This skill provides automated workflows for ensuring Ansible code quality, syntax validation, dry-run testing with check mode and molecule, and intelligent documentation lookup for custom modules and collections with version awareness.

Default behavior: When validating any Ansible role with a molecule/ directory, attempt Molecule automatically using bash scripts/test_role.sh <role-path>. If Molecule cannot run due to environment/runtime limits, mark Molecule as BLOCKED, report why, and continue all non-Molecule validation steps.

Trigger Guidance

Use this skill when the request is about validating or debugging existing Ansible code, not generating new code.

Common trigger phrases:

  • "validate this playbook"
  • "lint this role"
  • "why is ansible-lint failing"
  • "run check mode safely"
  • "test this role with molecule"
  • "find security issues in these Ansible files"
  • "module not found in this collection"

When to Use This Skill

Apply this skill when encountering any of these scenarios:

  • Working with Ansible files (.yml, .yaml playbooks, roles, inventories, vars)
  • Validating Ansible playbook syntax and structure
  • Linting and formatting Ansible code
  • Performing dry-run testing with ansible-playbook --check
  • Testing roles and playbooks with Molecule
  • Debugging Ansible errors or misconfigurations
  • Understanding custom Ansible modules, collections, or roles
  • Ensuring infrastructure-as-code best practices
  • Security validation of Ansible playbooks
  • Version compatibility checks for collections and modules

Preflight (Run First)

Run preflight before validation to avoid dead ends:

bash scripts/setup_tools.sh

Command path assumption: run commands from this skill root (devops-skills-plugin/skills/ansible-validator) or use absolute paths.

Preflight requirements:

  • Baseline validation: ansible, ansible-playbook, ansible-lint (plus yamllint recommended)
  • Molecule execution: molecule plus an available runtime (docker or podman)
  • Security scanning: checkov (wrapper can bootstrap if missing)

Deterministic fallback rules:

  • If baseline tools are missing but Python + pip are available, wrapper scripts bootstrap temporary environments automatically.
  • If wrapper bootstrap fails (offline index, pip failure, missing Python), run direct commands for available tools, mark missing stages as BLOCKED, and continue.
  • If Molecule runtime is unavailable (Docker/Podman missing or daemon not running), skip Molecule execution, mark as BLOCKED, and continue remaining stages.

Wrapper vs Direct Command Routing

Use wrappers by default for consistent behavior and fallback handling.

Validation scenarioDefault commandUse direct command whenFallback if command cannot run
Playbook syntax/lintbash scripts/validate_playbook.sh <playbook.yml>User asks for a single focused check only (ansible-playbook --syntax-check, ansible-lint, or yamllint)Run any available direct checks and report skipped checks as BLOCKED
Role structural validationbash scripts/validate_role.sh <role-dir>User asks only for specific sub-checks (for example, structure only)Run structure/YAML checks that are possible and report missing stages
Role Molecule executionbash scripts/test_role.sh <role-dir> [scenario]User explicitly asks for manual stage-by-stage Molecule commandsMark Molecule BLOCKED with reason and continue non-Molecule role checks
Security scanningbash scripts/validate_playbook_security.sh <path> or bash scripts/validate_role_security.sh <path> plus bash scripts/scan_secrets.sh <path>User requests raw Checkov output formatting or custom flagsRun whichever scanner is available; if one is missing, run the other and report coverage gap
Module/collection discoverybash scripts/extract_ansible_info_wrapper.sh <path>Python environment is already known-good and user wants direct parser outputIf extraction fails, manually inspect requirements.yml/galaxy.yml and continue with best-effort lookup

Validation Workflow

Follow this deterministic workflow and never stop at a missing dependency:

0. Preflight
   ├─> Run: bash scripts/setup_tools.sh
   ├─> Record tool/runtime readiness
   └─> Continue even when optional tools are missing

1. Identify scope
   ├─> Single playbook validation
   ├─> Role validation
   ├─> Collection validation
   └─> Multi-playbook/inventory validation

2. Syntax Validation
   ├─> Run ansible-playbook --syntax-check
   ├─> Run yamllint for YAML syntax
   └─> Report as PASS/FAIL/BLOCKED

3. Lint and Best Practices
   ├─> Run ansible-lint (comprehensive linting)
   ├─> Check for deprecated modules (see references/module_alternatives.md)
   ├─> **DETECT NON-FQCN MODULE USAGE** (apt vs ansible.builtin.apt)
   │   └─> Run bash scripts/check_fqcn.sh to identify short module names
   │   └─> Recommend FQCN alternatives from references/module_alternatives.md
   ├─> Verify role structure
   └─> Report linting issues

4. Dry-Run Testing (check mode)
   ├─> Run ansible-playbook --check (if inventory available)
   ├─> Analyze what would change
   └─> Report potential issues

5. Molecule Testing (for roles with molecule/) - AUTOMATIC ATTEMPT
   ├─> Check if molecule/ directory exists in role
   ├─> If present, run: bash scripts/test_role.sh <role-path> [scenario]
   ├─> If script exits 2, mark Molecule as BLOCKED (environment/runtime issue)
   ├─> If script exits 1, mark Molecule as FAIL (role/test issue)
   └─> Continue remaining validation regardless of Molecule outcome

6. Custom Module/Collection Analysis (if detected)
   ├─> Extract module/collection information
   ├─> Identify versions
   ├─> Lookup documentation (Context7 first, then web.search_query fallback)
   └─> Provide version-specific guidance

7. Security and Best Practices Review - DUAL SCANNING DEFAULT
   ├─> Run bash scripts/validate_playbook_security.sh or validate_role_security.sh (Checkov)
   ├─> Run bash scripts/scan_secrets.sh for hardcoded secret detection
   │   └─> This catches secrets Checkov may miss (passwords, API keys, tokens)
   ├─> If one scanner is unavailable, run the other and report reduced coverage
   ├─> Validate privilege escalation
   ├─> Review file permissions
   └─> Identify common anti-patterns

8. Reference Routing
   ├─> Map each error/warning class to the matching reference file
   ├─> Extract concrete remediation from references (not file-name-only mention)
   └─> Include source section + fix guidance in final report

9. Final Report (required format)
   ├─> Summary counts: PASS / FAIL / BLOCKED / SKIPPED
   ├─> Findings grouped by severity
   ├─> Tool/runtime blockers with exact command that failed
   └─> Next actions to reach full validation coverage

Status contract: BLOCKED means validation could not run due to environment/runtime constraints; FAIL means the Ansible code or tests failed.

Error-Class Reference Routing

When issues are detected, consult the mapped reference and include a specific remediation excerpt in the report.

Error classTypical detectorRequired referenceRequired action
YAML parse/format errorsyamllint, ansible-playbook --syntax-checkreferences/common_errors.md (Syntax Errors)Quote the matching syntax fix pattern and apply corrected YAML structure
Module/action resolution errorsansible-playbook, ansible-lintreferences/common_errors.md (Module/Collection Errors)Provide install/version fix commands (ansible-galaxy collection install ...)
Deprecated or non-FQCN module usageansible-lint, bash scripts/check_fqcn.shreferences/module_alternatives.mdProvide exact FQCN/module replacement per finding

Use this skill in a project

Open any RiverX project, search the Skills panel for akin-ozer/cc-devops-skills/ansible-validator, and install it in one click.

Use this skill