ansible-validator
Validate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks.
What this skill does
# 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 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 scenario | Default command | Use direct command when | Fallback if command cannot run | |---|---|---|---| | Playbook syntax/lint | `bash 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 validation | `bash 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 execution | `bash scripts/test_role.sh <role-dir> [scenario]` | User explicitly asks for manual stage-by-stage Molecule commands | Mark Molecule `BLOCKED` with reason and continue non-Molecule role checks | | Security scanning | `bash 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 flags | Run whichever scanner is available; if one is missing, run the other and report coverage gap | | Module/collection discovery | `bash scripts/extract_ansible_info_wrapper.sh <path>` | Python environment is already known-good and user wants direct parser output | If 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 class | Typical detector | Required reference | Required action | |---|---|---|---| | YAML parse/format errors | `yamllint`, `ansible-playbook --syntax-check` | `references/common_errors.md` (Syntax Errors) | Quote the matching syntax fix pattern and apply corrected YAML structure | | Module/action resolution errors | `ansible-playbook`, `ansible-lint` | `references/common_errors.md` (Module/Collection Errors) | Provide install/version fix commands (`ansible-galaxy collection install ...`) | | Deprecated or non-FQCN module usage | `ansible-lint`, `bash scripts/check_fqcn.sh` | `references/module_alternatives.md` | Provide exact FQCN/module replacement per finding | | Template/variable errors | `ansible-playbook`, c
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.