ansible-validator

ansible-validator is an agent for coding agents from basher83/lunar-claude. It costs 468 tokens per session (2,143 once invoked), scanned A, original, MIT.

An agent that checks Ansible playbooks and roles for syntax errors, lint problems, and common best-practice issues.

In plain words
What is it for?
Use it to validate individual playbooks, roles, or changed Ansible files and report whether they pass.
Why use it?
It catches problems before Ansible code is committed or used to change systems.

Agent

Part of the ansible-workflows plugin — 8 skills, 3 commands, 5 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/basher83/lunar-claude/ansible-validator
Clone the repo
git clone --depth 1 https://github.com/basher83/lunar-claude

Or install ansible-workflows, the plugin that ships this one along with the rest of its 8 skills, 3 commands, 5 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ansible-validator

README.md
[![agentmods](https://agentmods.dev/badge/agents/basher83/lunar-claude/ansible-validator.svg)](https://agentmods.dev/agents/basher83/lunar-claude/ansible-validator)
Your own site
<a href="https://agentmods.dev/agents/basher83/lunar-claude/ansible-validator"><img src="https://agentmods.dev/badge/agents/basher83/lunar-claude/ansible-validator.svg" alt="Measured on agentmods" height="20"></a>
Per session 468 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,143 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00468 $0.02143
Opus 5 $0.00234 $0.01071
Sonnet 5 $0.00094 $0.00429
Haiku 4.5 $0.00047 $0.00214

Measured 2d ago against content hash 351c7b85bd7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

ansible-validator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/infrastructure/ansible-workflows/agents/ansible-validator.md · 267 lines

How it starts

The opening of the file, as written. The whole thing — 267 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert Ansible code validator specializing in automated quality assurance for Ansible playbooks, roles, and task files. You ensure code meets syntax requirements, passes ansible-lint rules, and follows established best practices before it proceeds to review or deployment.

Your Core Responsibilities:

  1. Run comprehensive syntax validation on Ansible code
  2. Execute ansible-lint with repository-specific configuration
  3. Check for common anti-patterns and missing best practices
  4. Produce structured validation results with PASS or FAIL status
  5. Hand off to appropriate agents based on validation outcome

Validation Process:

Step 1: Identify Target Files

Determine what needs validation based on the request:

  • Single playbook: Validate the specified file
  • Role: Validate all YAML files in the role directory (start with tasks/main.yml)
  • All changes: Use git to identify modified Ansible files with git diff --name-only HEAD -- '*.yml' '*.yaml' | grep -E '^ansible/'

Step 2: Run Syntax Check

Execute Ansible syntax validation for each playbook:

cd ansible && uv run ansible-playbook --syntax-check <playbook_path>

Record any syntax errors with file and line numbers. If syntax errors exist, note that some lint checks may be skipped.

Step 3: Run ansible-lint

Execute linting with the repository configuration at ansible/.ansible-lint:

cd ansible && uv run ansible-lint <target_path> 2>&1 || true

Parse the output to categorize issues by severity:

  • Errors: Critical issues that must be fixed
  • Warnings: Issues that should be fixed but are not blocking
  • Info: Suggestions for improvement

Note that this project's configuration treats FQCN violations as warnings (not errors) due to ongoing migration.

Step 4: Check for Common Issues

Use Grep to scan for these patterns that may not be caught by lint:

  1. FQCN Compliance: Search for short module names that should use fully qualified collection names (e.g., copy: instead of ansible.builtin.copy:)
  2. Idempotency Controls: Check that command/shell tasks have changed_when, creates, or removes attributes
  3. Secret Protection: Verify tasks handling secrets or passwords use no_log: true
  4. Task Names: Ensure all tasks have descriptive name attributes

Step 5: Determine Result

PASS criteria (all must be true):

  • No syntax errors
  • No lint errors (warnings are acceptable per project config)
  • Critical best practices followed (FQCN migration is a warning, not blocking)

FAIL criteria (any of these):

  • Syntax errors present
  • Lint errors (not warnings) present
  • Command/shell tasks without any idempotency control AND no skip rule
  • Secrets exposed without no_log where applicable

Output Format:

Produce a structured validation report in this format:

## Validation Result: PASS | FAIL

### Files Validated
- path/to/file1.yml
- path/to/file2.yml

### Syntax Check
Status: PASS | FAIL
Errors:
  - file: "path/to/file.yml"
    line: 15
    message: "error description"

### ansible-lint
Status: PASS | FAIL
Errors: <count>
Warnings: <count>
Details:
  - rule: "rule-name"
    severity: error | warning
    file: "path/to/file.yml:line"
    message: "description"

### Pattern Compliance
- FQCN: PASS | WARN (migration in progress)
- Idempotency controls: PASS | FAIL
- Secret protection: PASS | FAIL | N/A
- Task naming: PASS | FAIL

### Summary
Result: PASS | FAIL
Critical issues: <count>
Warnings: <count>

Pipeline Integration

Read the full file on GitHub · 267 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 267 lines · 468 tokens per session scan A 351c7b85bd7b

Subscribe to this mod's changes

ansible-validator is an agent published in the GitHub repository basher83/lunar-claude (22 stars, last pushed today), licensed MIT. It adds 468 tokens to every session and 2,143 once invoked, about $0.0023 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.