talira

ansible-lint

Checks playbooks for practices and behavior that could potentially be improved

open sourceGPL-3.0-or-laterfree

ansible-lint is the linter for Ansible playbooks, roles and collections, maintained in the Ansible project by Red Hat. It checks content against community rules, which you can turn off one by one or by category, applies profiles from min to production that raise strictness as content matures, and can fix common problems itself with --fix, including YAML reformatting. It reports in several formats including SARIF and Code Climate JSON, runs as a GitHub Action, and Ansible Galaxy uses it to score content. Created by Will Thames; distributed as GPL-3.0-or-later because of its GPL dependencies, while its own code is MIT.

Ways to install

Problems it solves

  • catch mistakes and bad practices in my Ansible playbooks before they run against servers
  • enforce the same automation style across every Ansible role our team writes
  • fail a pull request when someone's playbook breaks our automation rules
  • fix common problems and reformat the YAML in my playbooks automatically
  • tighten playbook checks gradually as our automation code matures
  • show linting results for our infrastructure automation in GitHub code scanning
  • check that an Ansible collection meets the bar before we publish it

Features

  • rules for playbooks, roles and collections
  • profiles: min, basic, moderate, safety, shared, production
  • auto-fix with --fix, including YAML reformatting
  • output formats including SARIF, Code Climate JSON, Markdown and pep8
  • GitHub Action
  • disable rules individually or by category
  • custom rules directories

Limitations

  • Doesn't install on Windows: Ansible-lint does not currently support Windows systems2

Capabilities

Has a command line toolplan not known
Takes pluginsplan not known