Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ansible-validator

БесплатноЗапускает вложенные скриптыНе проверен

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

akin-ozerот akin-ozer★ 346 звёзд на GitHub

Об этом скилле

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 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)
   │   └─>
Полный SKILL.md на GitHub

Установить ansible-validator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.gitignoreassets/.ansible-lintassets/.yamllintassets/molecule.yml.templatereferences/best_practices.mdreferences/common_errors.mdreferences/module_alternatives.mdreferences/security_checklist.mdscripts/check_fqcn.shscripts/extract_ansible_info.pyscripts/extract_ansible_info_wrapper.shscripts/scan_secrets.shscripts/setup_tools.shscripts/test_role.shscripts/validate_inventory.shscripts/validate_playbook.shscripts/validate_playbook_security.shscripts/validate_role.shscripts/validate_role_security.sh

FAQ

Что делает скилл ansible-validator?

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

Как установить скилл ansible-validator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ansible-validator запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить ansible-validator с