ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you
Find a file
pre-commit-ci[bot] 444be15e3b
chore: pre-commit autoupdate (#4859)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alison Hart <alhart@redhat.com>
2025-12-03 11:10:45 -05:00
.config chore: adopt pytest>=9.0.0 config (#4861) 2025-12-02 13:54:56 -05:00
.github chore(deps): update all dependencies (#4852) 2025-12-02 11:21:59 -05:00
.sonarlint chore: replace prettier with biome (#4765) 2025-09-12 17:14:04 -04:00
.vscode chore: replace prettier with biome (#4765) 2025-09-12 17:14:04 -04:00
collections/ansible_collections/local/testcollection Address too many values to unpack when there's subdirectories for roles (#4566) 2025-06-17 12:33:14 +01:00
docs Migrate RTD URLs to docs.ansible.com (#4842) 2025-11-19 14:08:09 -07:00
examples feat: detect missing prefix in role's handlers vars (#4826) 2025-11-20 14:44:09 -05:00
plugins/modules Pyright type fixes (partial) (#4411) 2024-11-16 14:47:06 +00:00
src/ansiblelint chore(deps): update all dependencies (#4852) 2025-12-02 11:21:59 -05:00
test chore(deps): update all dependencies (#4852) 2025-12-02 11:21:59 -05:00
tools chore(deps): update all dependencies (#4817) 2025-10-29 10:08:55 -04:00
.ansible-lint Require ansible-core>=2.16 (#4483) 2025-01-19 20:40:39 +00:00
.ansible-lint-ignore Migrate RTD URLs to docs.ansible.com (#4842) 2025-11-19 14:08:09 -07:00
.darglint Some linting fixes (#2766) 2022-12-02 16:47:31 +00:00
.git_archival.txt Fix github archives metadata (#2914) 2023-01-18 16:53:18 +00:00
.gitattributes Mark png files as binary 2020-04-17 16:30:30 +02:00
.gitignore Reapply "fix: adopt uv.lock and dependency-groups (#4757)" (#4761) 2025-09-09 17:23:44 -04:00
.gitmodules Revert ansible-compat vendoring (#3478) 2023-05-22 14:38:45 +01:00
.packit.yaml packit: reformat, remove deprecated syntax and try merge queue (#4639) 2025-07-04 16:18:44 +01:00
.pre-commit-config.yaml chore: pre-commit autoupdate (#4859) 2025-12-03 11:10:45 -05:00
.pre-commit-hooks.yaml Fix typos (#4814) 2025-10-10 16:33:32 -04:00
.prettierignore Normalize format of non-test yaml files (#1921) 2022-02-17 13:41:23 -06:00
.prettierrc.yaml Assimilate schemas project (#2769) 2022-12-02 22:32:36 +00:00
.readthedocs.yml Reapply "fix: adopt uv.lock and dependency-groups (#4757)" (#4761) 2025-09-09 17:23:44 -04:00
.vault_pass Refactor use of app instance (#4478) 2025-01-20 09:03:12 +05:30
.yamllint Prevent execution with incompatible yamllint configuration (#4139) 2024-05-07 15:26:27 +01:00
action.yml chore(deps): update all dependencies (#4817) 2025-10-29 10:08:55 -04:00
ansible.cfg Refactor use of app instance (#4478) 2025-01-20 09:03:12 +05:30
biome.json chore: replace prettier with biome (#4765) 2025-09-12 17:14:04 -04:00
codecov.yml Remove patch report from codecov (#4671) 2025-06-30 13:22:21 +00:00
conftest.py Enable testing with python 3.14 (#4637) 2025-06-25 08:04:28 +00:00
COPYING Clarify GPLv3 license of the distribution (#1882) 2022-02-14 16:02:38 +00:00
cspell.config.yaml Reapply "fix: adopt uv.lock and dependency-groups (#4757)" (#4761) 2025-09-09 17:23:44 -04:00
DCO_1_1.md Enable prettier for all supported formats (#1925) 2022-02-17 21:01:54 +00:00
mkdocs.yml Migrate RTD URLs to docs.ansible.com (#4842) 2025-11-19 14:08:09 -07:00
package-lock.json chore(deps): update all dependencies (#4852) 2025-12-02 11:21:59 -05:00
package.json Remove dead code and prevent regressions (#4425) 2024-11-26 10:07:13 +00:00
playbook.yml Improve logic of find_children (#4161) 2024-06-04 16:17:10 +01:00
pyproject.toml chore: adopt pytest>=9.0.0 config (#4861) 2025-12-02 13:54:56 -05:00
README.md Migrate RTD URLs to docs.ansible.com (#4842) 2025-11-19 14:08:09 -07:00
renovate.json chore: Remove cffi, importlib-metadata, reduce core lower bound (#4860) 2025-12-02 07:14:43 -08:00
requirements.yml Refactor types for future ansible-core compatibility (#4557) 2025-03-24 18:28:25 +05:30
sonar-project.properties Update sonar-project.properties (#4815) 2025-10-14 14:13:25 -04:00
uv.lock chore: adopt pytest>=9.0.0 config (#4861) 2025-12-02 13:54:56 -05:00

PyPI version Ansible-lint rules explanation Discussions pre-commit

Ansible-lint

ansible-lint checks playbooks for practices and behavior that could potentially be improved. As a community-backed project ansible-lint supports only the last two major versions of Ansible.

Visit the Ansible Lint docs site

Using ansible-lint as a GitHub Action

This action allows you to run ansible-lint on your codebase without having to install it yourself.

# .github/workflows/ansible-lint.yml
name: ansible-lint
on:
  pull_request:
    branches: ["main", "stable", "release/v*"]
jobs:
  build:
    name: Ansible Lint # Naming the build is important to use it as a status check
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - name: Run ansible-lint
        uses: ansible/ansible-lint@main # or vX.X.X version
        # optional (see below):
        with:
          args: ""
          gh_action_ref: "<version - e.g. `v25.5.0`>" # Not recommended for non-composite action use
          setup_python: "true"
          working_directory: ""
          requirements_file: ""

By default, the workflow uses ansible-lint installed from main. For production or stable workflows, it is recommended to specify a particular release tag (in format v.X.X.X).

All the arguments are optional:

  • args: Arguments to be passed to ansible-lint command.
  • gh_action_ref: The git branch, tag, or commit to use for ansible-lint. Not recommended for standard use - only use with composite actions where GH_ACTION_REF is set to the parent action version.
  • requirements_file: Path to the requirements.yml file to install role and collection dependencies.
  • setup_python: If python should be installed. Default is true.
  • working_directory: The directory where to run ansible-lint from. Default is github.workspace. Needed if you want to lint only a subset of your repository.

For more details, see ansible-lint-action.

Communication

Refer to the Talk to us section of the Contributing guide to find out how to get in touch with us.

You can also find more information in the Ansible communication guide.

Contributing

Please read Contribution guidelines if you wish to contribute.

Code of Conduct

Please see the Ansible Community Code of Conduct.

Licensing

The ansible-lint project is distributed as GPLv3 due to use of GPLv3 runtime dependencies, like ansible and yamllint.

For historical reasons, its own code-base remains licensed under a more liberal MIT license and any contributions made are accepted as being made under original MIT license.

Authors

ansible-lint was created by Will Thames and is now maintained as part of the Ansible by Red Hat project.