# ansible/ansible-lint

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ansible-ansible-lint).**

3,835 stars · 719 forks · Python · gpl-3.0

## Links

- GitHub: https://github.com/ansible/ansible-lint
- Homepage: https://ansible.readthedocs.io/projects/lint/
- awesome-repositories: https://awesome-repositories.com/repository/ansible-ansible-lint.md

## Topics

`ansible` `ansible-dev-tools` `ansible-lint` `dot-config` `hacktoberfest` `pep-621` `pre-commit-hook`

## Description

ansible-lint is a static code analysis tool and linter designed to identify syntax errors and best practice violations within Ansible playbooks and roles. It functions as a quality gate for automation pipelines, scanning configuration files and scripts without executing the code to ensure reliability and consistency.

The project distinguishes itself by acting as an automated code formatter that can correct identified linting issues and reformat files to meet community standards. It also serves as a dependency manager, automatically detecting and installing required roles and collections from requirements files to ensure comprehensive analysis of the codebase.

The tool provides extensive rule management, allowing for the use of custom rule sets, tag-based filtering, and the suppression of false positives through inline comments. It further supports infrastructure standardization by identifying outdated code patterns for version migrations and exporting analysis results in structured formats like SARIF and JSON.

Integration is provided for continuous integration workflows, including specific support for GitHub Actions.

## Tags

### Development Tools & Productivity

- [Static Analysis Rules](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/static-analysis-engines/static-analysis-tools/static-analysis-rules.md) — Analyzes configuration files using predefined logic patterns to detect syntax errors and best practice violations.
- [Code Quality and Analysis](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis.md) — Scans configuration files and roles to identify common pitfalls and ensure adherence to best practices. ([source](https://docs.ansible.com/projects/lint/))
- [Playbook Analysis](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/playbook-analysis.md) — Evaluates automation scripts and collections for syntax errors and best practice violations. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Dependency-Aware Code Analysis](https://awesome-repositories.com/f/development-tools-productivity/dependency-analysis-tools/code-dependency-analysis/dependency-aware-code-analysis.md) — Ensures comprehensive analysis by automatically resolving and installing required roles and collections from requirements files.
- [Dependency Installers](https://awesome-repositories.com/f/development-tools-productivity/dependency-managers/installation-resolution-utilities/dependency-installers.md) — Automatically detects and installs required external roles and collections from requirements files for comprehensive analysis. ([source](https://docs.ansible.com/projects/lint/usage/))
- [AST-Based Source Transformations](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-to-source-conversion/ast-based-source-transformations.md) — Provides automated correction of linting violations by transforming the source code via abstract syntax tree manipulation.
- [Automated Lint Fixes](https://awesome-repositories.com/f/development-tools-productivity/automated-lint-fixes.md) — Provides automated fixing of linting violations to quickly align code with project standards. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Automatic Code Formatters](https://awesome-repositories.com/f/development-tools-productivity/automatic-code-formatters.md) — Automatically corrects identified linting issues and reformats files to adhere to community style standards.
- [Per-Rule Configurations](https://awesome-repositories.com/f/development-tools-productivity/automation-rules/rule-encapsulation/reusable-rule-logic/configurable-rule-groups/per-rule-configurations.md) — Bypasses designated rules for a project to prevent unwanted warnings and facilitate gradual content updates. ([source](https://docs.ansible.com/projects/lint/philosophy/))
- [Custom Lint Rule Plugins](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/static-analysis-engines/static-analysis-tools/static-analysis-rules/framework-linting-rules/core-rule-extensions/custom-lint-rule-plugins.md) — Loads external rule directories as plugins to extend default validation logic with project-specific requirements. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Custom Lint Rule Definitions](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/static-analysis-engines/static-analysis-tools/static-analysis-rules/framework-linting-rules/core-rule-extensions/custom-lint-rule-plugins/custom-lint-rule-definitions.md) — Provides interfaces for defining and disabling specific linting rules to align with project-specific requirements. ([source](https://docs.ansible.com/projects/lint/))
- [Dependency Caches](https://awesome-repositories.com/f/development-tools-productivity/dependency-caches.md) — Stores installed roles, collections, and modules locally to reduce the time spent on subsequent validation runs. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Ansible Dependency Resolvers](https://awesome-repositories.com/f/development-tools-productivity/dependency-managers/installation-resolution-utilities/dependency-installers/ansible-dependency-resolvers.md) — Automatically detects and installs required external roles and collections to ensure complete analysis of the codebase.
- [Local Dependency Caching](https://awesome-repositories.com/f/development-tools-productivity/local-dependency-caching.md) — Stores downloaded roles and collections in a persistent local cache to accelerate subsequent validation cycles.
- [Version Migration Scripts](https://awesome-repositories.com/f/development-tools-productivity/version-migration-scripts.md) — Identifies outdated code patterns and incompatible modules to streamline the upgrade process to newer Ansible versions.

### Testing & Quality Assurance

- [Ansible Linters](https://awesome-repositories.com/f/testing-quality-assurance/ansible-linters.md) — Analyzes Ansible playbooks and roles to identify syntax errors and best practice violations.
- [Static Code Analysis Tools](https://awesome-repositories.com/f/testing-quality-assurance/code-quality-review/code-quality-tools/static-code-analysis-tools.md) — Examines configuration files and automation scripts without executing them to find bugs and style violations.
- [Quality Gates](https://awesome-repositories.com/f/testing-quality-assurance/ci-integration-testing/quality-gates.md) — Acts as a verification step in automation pipelines to prevent the merging of code that violates quality standards.
- [Infrastructure Configuration Audits](https://awesome-repositories.com/f/testing-quality-assurance/properties-file-auditing/infrastructure-configuration-audits.md) — Analyzes configuration files for non-standard practices and behavioral improvements to ensure quality. ([source](https://cdn.jsdelivr.net/gh/ansible/ansible-lint@main/README.md))

### DevOps & Infrastructure

- [Playbook Quality Analysis](https://awesome-repositories.com/f/devops-infrastructure/ansible-playbooks/playbook-quality-analysis.md) — Checks automation scripts for syntax errors and best practice violations to ensure reliable deployments.
- [CI Pipeline Integrations](https://awesome-repositories.com/f/devops-infrastructure/ci-cd-pipelines/ci-pipeline-integrations.md) — Runs automated style and practice checks within continuous integration workflows to verify code quality before merging. ([source](https://cdn.jsdelivr.net/gh/ansible/ansible-lint@main/README.md))
- [Continuous Integration Checks](https://awesome-repositories.com/f/devops-infrastructure/continuous-integration-pipelines/continuous-integration-checks.md) — Integrates linting and quality checks directly into continuous integration pipelines to verify code before merging.
- [Tag-Based Rule Filtering](https://awesome-repositories.com/f/devops-infrastructure/label-based-selection/target-selection-rules/selector-based-rule-filtering/tag-based-rule-filtering.md) — Enables including or excluding groups of rules based on categories such as security, idempotency, or formatting. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Migration Analysis Tools](https://awesome-repositories.com/f/devops-infrastructure/version-upgrades/migration-analysis-tools.md) — Identifies code patterns incompatible with newer engine versions to streamline the migration process. ([source](https://docs.ansible.com/projects/lint/))

### Software Engineering & Architecture

- [Coding Standards Enforcement](https://awesome-repositories.com/f/software-engineering-architecture/coding-standards-enforcement.md) — Maintains project quality by automatically identifying syntax errors, deprecated modules, and naming inconsistencies. ([source](https://docs.ansible.com/projects/lint/rules/))
- [Plugin-Based Style Rule Extensions](https://awesome-repositories.com/f/software-engineering-architecture/custom-validation-rules/plugin-based-style-rule-extensions.md) — Enables the addition of custom validation and formatting rules through external plugin directories.
- [GitHub Actions](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/workflow-automation-integrations/ci-cd-integrations/github-actions.md) — Integrates playbook verification into GitHub delivery pipelines to validate best practices during pull requests. ([source](https://docs.ansible.com/projects/lint/installing/))
- [Codebase Standardization](https://awesome-repositories.com/f/software-engineering-architecture/project-management-governance/project-governance/standards-rule-enforcement/codebase-standardization.md) — Enforces uniform formatting and naming conventions across Ansible roles and collections to maintain codebase consistency.
- [Quality Profiles](https://awesome-repositories.com/f/software-engineering-architecture/quality-profiles.md) — Enforces different levels of strictness ranging from minimal syntax checks to production-ready reliability standards. ([source](https://docs.ansible.com/projects/lint/usage/))
- [Rule Suppression Comments](https://awesome-repositories.com/f/software-engineering-architecture/warning-issuance-systems/warning-suppressions/suppression-comment-governors/rule-suppression-comments.md) — Allows disabling specific linting rules for targeted lines or blocks using inline source code comments.

### Security & Cryptography

- [Configuration Audits](https://awesome-repositories.com/f/security-cryptography/security-auditing/configuration-audits.md) — Provides automated checks of configuration files to identify security misconfigurations and reliability pitfalls based on community standards.
