Ansible Lint
$ ansible-lint Official Low Riskansible-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.
brew install ansible-lint Direct local static analysis with -f json and --offline; no MCP server can replace full local repo linting.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports -f json, -f sarif, --offline, and --nocolor, though Ansible Galaxy dependency resolution can pollute output unless --offline is passed.
- Code Climate
-f jsonand-f sarifoutput formats - Requires
--offlinein air-gapped sandboxes to avoid Galaxy lookups
Read-only by default; file mutations only occur when explicitly invoking --fix.
- Read-only default; explicit opt-in
--fixfor local rewrites
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
Catches FQCN, Jinja2, and YAML pitfalls automatically; --fix automates routine cleanup.
- Covers syntax, schema, deprecation, and style rules
Official Ansible project (ansible/ansible-lint) maintained by Red Hat / Ansible community under MIT.
- Official
ansible/ansible-lintrepo under MIT
Detailed ReadTheDocs documentation with per-rule explanations and examples.
- Rule catalog at ansible.readthedocs.io/projects/lint/
Security, Auth & Guardrails
No credentials required for linting; optional Ansible Galaxy tokens are only needed if fetching private collections.
MIT open-source and free.
# 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
ansible-lint --offline -f json
Emits Code Climate JSON findings across playbooks and roles without touching Ansible Galaxy.
ansible-lint --offline -q -f pep8 playbooks/site.yml
Outputs compact file:line: rule diagnostics for quick agent parsing.
Controlled Writes & Previews
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--nocolorfor clean CI/agent integration. - +
--offlinemode enables fast, deterministic linting in restricted sandboxes. - + Optional
--fixautomates FQCN and YAML formatting fixes.
Caveats & Pitfalls
- ! No native Windows support (requires WSL on Windows).
- ! Default run may attempt Ansible Galaxy metadata fetches unless
--offlineis specified.