Linters
What is ansible-lint? An introduction to Ansible's playbook linter
ansible-lint is a linter that checks Ansible playbooks for practices and behavior that could be improved. It can also fix some common issues automatically. It is community-backed and supports only the last two major versions of Ansible.
- Tool
- ansible-lint
- Made by
- Ansible
- Official site
- github.com/ansible/ansible-lint
- Category
- Linters
Who makes ansible-lint
ansible-lint is published under the Ansible name. It was created by Will Thames and is now maintained as part of the Ansible by Red Hat project. The official website is the project's GitHub repository, linked below, and a dedicated documentation site also exists.
Official website: github.com/ansible/ansible-lint
What ansible-lint is for
ansible-lint reviews Ansible playbooks and points out practices and behavior that could be improved. Its aim is to surface potential problems in automation content before they cause trouble.
For some of the common issues it finds, the tool can apply fixes itself, which saves manual edits for routine corrections.
Who ansible-lint is for
The vendor does not state a target audience. The tool is relevant to people who write and maintain Ansible playbooks and want them reviewed against recommended practices.
Because it supports only the last two major versions of Ansible, it suits teams working on those releases. The GitHub Action makes it practical for repositories that want checks to run without every contributor installing the tool.
Notable capabilities
Much of what the project documents concerns running ansible-lint as a GitHub Action, alongside its core checking and fixing. The following capabilities come from its verified facts.
- Playbook checks: it reports potentially improvable practices and behavior in Ansible playbooks.
- Automatic fixes: it can fix some of the common issues it finds.
- GitHub Action: it can be run as a GitHub Action without installing it yourself.
- Pass-through arguments: the action accepts optional arguments that are passed to the ansible-lint command.
- Dependency installation: the action can install role and collection dependencies from a requirements file.
- Python setup: the action can set up Python and let you choose its version.
- Working directory: the working directory can be set so that only a subset of a repository is linted.
- Release pinning: for production or stable workflows, pinning a specific release tag is recommended.
How ansible-lint fits linters
ansible-lint is a linter specialized for one automation tool. Instead of checking a general-purpose language, it understands Ansible playbooks and the practices around them, which makes it a focused member of a linter collection.
On licensing, the project is distributed as GPLv3 because of GPLv3 runtime dependencies such as ansible and yamllint. Its own code base remains under the MIT license. Within the wider niche of static analysis and code quality, it brings automated review to infrastructure automation content.
Frequently asked questions
What is ansible-lint used for?
ansible-lint checks Ansible playbooks for practices and behavior that could be improved. It can also fix some common issues.
Who develops ansible-lint?
ansible-lint was created by Will Thames and is now maintained as part of the Ansible by Red Hat project. It is community-backed.
Which Ansible versions does ansible-lint support?
It supports only the last two major versions of Ansible.
Can I run ansible-lint in GitHub Actions?
Yes. It can run as a GitHub Action without installing it yourself. The action can pass optional arguments, install role and collection dependencies from a requirements file, set up Python and limit linting to a working directory.
What license is ansible-lint under?
The project is distributed as GPLv3 because of GPLv3 runtime dependencies such as ansible and yamllint. Its own code base remains under the MIT license.
Linthelm is independent and is not affiliated with Ansible. Product names belong to their owners. Features change; confirm details on the official website.