akin-ozer/cc-devops-skills/ansible-validator
Claude Code and agent skill by akin-ozer/cc-devops-skills
- community
Checking that the SKILL.md file is still in the repository.
Validate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks.
Install
npx vskill@latest install akin-ozer/cc-devops-skills/ansible-validatorSKILL.md
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,.yamlplaybooks, 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:
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(plusyamllintrecommended) - Molecule execution:
moleculeplus an available runtime (dockerorpodman) - 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:
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, check mode | references/common_errors.md (Template/Variable Errors), references/best_practices.md (Variable Management) | Recommend default(), required(), or type conversion fixes | |
| Connection/inventory/privilege errors | ansible-playbook --check, runtime output | references/common_errors.md (Connection, Inventory, Privilege sections) | Provide corrected inventory/auth/become configuration | |
| Security policy failures (CKV_*) | validate_*_security.sh / Checkov | references/security_checklist.md | Map failed policy to a secure task rewrite | |
| Hardcoded secrets | bash scripts/scan_secrets.sh | references/security_checklist.md (Secrets Management) | Replace with Vault/env/external secret manager approach | |
| Role structure/idempotency warnings | validate_role.sh, Molecule idempotence | references/best_practices.md | Provide role layout or idempotency remediation steps |
External documentation lookup trigger:
- If the issue involves a custom/private collection or unknown module parameters not covered locally, run module discovery + documentation lookup (see section 7).
Core Capabilities
1. YAML Syntax Validation
Purpose: Ensure YAML files are syntactically correct before Ansible parsing.
Tools:
yamllint- YAML linter for syntax and formattingansible-playbook --syntax-check- Ansible-specific syntax validation
Workflow:
Common Issues Detected:
- Indentation errors
- Invalid YAML syntax
- Duplicate keys
- Trailing whitespace
- Line length violations
- Missing colons or quotes
Best Practices:
- Always run yamllint before ansible-lint
- Use 2-space indentation consistently
- Configure yamllint rules in
.yamllint - Fix YAML syntax errors first, then Ansible-specific issues
2. Ansible Lint
Purpose: Enforce Ansible best practices and catch common errors.
Workflow:
Common Issues Detected:
- Deprecated modules or syntax
- Missing task names
- Improper use of
commandvsshell - Unquoted template expressions
- Hard-coded values that should be variables
- Missing
becomedirectives - Inefficient task patterns
- Jinja2 template errors
- Incorrect variable usage
- Role dependencies issues
Severity Levels:
- Error: Must fix - will cause failures
- Warning: Should fix - potential issues
- Info: Consider fixing - best practice violations
Auto-fix approach:
- ansible-lint supports
--fixfor auto-fixable issues - Always review changes before applying
- Some issues require manual intervention
3. Security Scanning (Checkov)
Purpose: Identify security vulnerabilities and compliance violations in Ansible code using Checkov, a static code analysis tool for infrastructure-as-code.
What Checkov Provides Beyond ansible-lint:
While ansible-lint focuses on code quality and best practices, Checkov specifically targets security policies and compliance:
- SSL/TLS Security: Certificate validation enforcement
- HTTPS Enforcement: Ensures secure protocols for downloads
- Package Security: GPG signature verification for packages
- Cloud Security: AWS, Azure, GCP misconfiguration detection
- Compliance Frameworks: Maps to security standards
- Network Security: Firewall and network policy validation
Workflow:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 85 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdevops-skills-plugin/skills/ansible-validator/SKILL.md
Popularity
- Repository stars
- 294
- Repository forks
- 32
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.
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
[](https://verified-skill.com/skills/akin-ozer/cc-devops-skills/ansible-validator)