Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Ansible Lint

$ ansible-lint Official Low Risk
Ansible · Cloud & Infra · MIT · macos / linux

ansible-lint checks Ansible playbooks, roles, and collections for syntax issues, deprecated modules, and best-practice violations. With -f json (Code Climate schema) and --offline, agents can lint Ansible repositories deterministically without external Galaxy network calls.

FCRS-1.0 Score
87 /100
Good
Medium Confidence
Zero-Friction Install
brew install ansible-lint
CLI vs MCP Decision CLI Preferred vs MCP

Direct local static analysis with -f json and --offline; no MCP server can replace full local repo linting.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports -f json, -f sarif, --offline, and --nocolor, though Ansible Galaxy dependency resolution can pollute output unless --offline is passed.

  • Code Climate -f json and -f sarif output formats
  • Requires --offline in air-gapped sandboxes to avoid Galaxy lookups
Trust & Safety 23 / 25

Read-only by default; file mutations only occur when explicitly invoking --fix.

  • Read-only default; explicit opt-in --fix for local rewrites
Setup & Portability 11 / 15

Distributed via Homebrew, pip, and uvx on macOS and Linux, but pulls ansible-core and lacks native Windows support.

  • Depends on Python + ansible-core; macOS/Linux only
Utility & Efficiency 13 / 15

Catches FQCN, Jinja2, and YAML pitfalls automatically; --fix automates routine cleanup.

  • Covers syntax, schema, deprecation, and style rules
Maintenance & Lineage 10 / 10

Official Ansible project (ansible/ansible-lint) maintained by Red Hat / Ansible community under MIT.

  • Official ansible/ansible-lint repo under MIT
Docs & Verifiability 9 / 10

Detailed ReadTheDocs documentation with per-rule explanations and examples.

  • Rule catalog at ansible.readthedocs.io/projects/lint/

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials required for linting; optional Ansible Galaxy tokens are only needed if fetching private collections.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source and free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# ansible-lint Agent Rules
- Always pass `--offline` in sandboxed environments to prevent Galaxy network hangs.
- Use `-f json` (or `-f sarif`) for structured findings and avoid `--fix` without reviewing `git diff`.
- Check `.ansible-lint` config in repo root before overriding rules.

Agent-Ready Command Recipes

Safe Read-Only Queries

Lint Ansible repo offline as JSON
ansible-lint --offline -f json

Emits Code Climate JSON findings across playbooks and roles without touching Ansible Galaxy.

Lint a specific playbook with quiet output
ansible-lint --offline -q -f pep8 playbooks/site.yml

Outputs compact file:line: rule diagnostics for quick agent parsing.

Controlled Writes & Previews

Auto-fix safe formatting violations
ansible-lint --offline --fix=all playbooks/site.yml

Applies automated YAML and FQCN rewrites locally via --fix (review git diff afterward).

Strengths for Agents

  • + Supports -f json, -f sarif, and --nocolor for clean CI/agent integration.
  • + --offline mode enables fast, deterministic linting in restricted sandboxes.
  • + Optional --fix automates FQCN and YAML formatting fixes.

Caveats & Pitfalls

  • ! No native Windows support (requires WSL on Windows).
  • ! Default run may attempt Ansible Galaxy metadata fetches unless --offline is specified.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI