Ansible-lint checks Ansible playbooks, roles, and collections for improvable practices, with community rules you can disable individually or by category.
Overview
Ansible Lint is a command-line tool aimed at anyone writing Ansible automation. It inspects playbooks, roles, and collections to surface patterns and behaviors that may cause bugs or harder maintenance, and it can fix some common issues automatically.
The tool is opinionated but community-driven: rules reflect contributed guidance, and users can turn off specific checks when needed. Documentation recommends running it with recent Ansible versions so it can help you adapt content as Ansible evolves.
Ansible Galaxy uses this linter when computing quality scores for shared roles and collections, though the same checks are useful for private content. Galaxy metadata files such as galaxy.yml still aid documentation even when content is not published.
You can run ansible-lint locally or through a GitHub Action that installs the tool and optional role or collection requirements from a requirements file.
Key features
- Playbook, role, and collection linting
- Configurable rule categories
- Automatic fixes for common issues
- GitHub Action integration
- Galaxy metadata awareness
- Supports recent Ansible releases
Use cases
- Ansible playbook quality checks
- CI pipeline policy enforcement
- Role and collection review
- Galaxy publishing readiness
- Ansible upgrade hygiene