ansible-lint - lint tool for Ansible playbooks, roles and collections
ansible-lint [--profile PROFILE] [-p] [-x SKIP] [-w WARN] [lintables ...]
Options you will use
--profile {min,basic,moderate,safety,shared,production}- Specify which rules profile to be used.
-p, --parseable- Parseable output (pep8 format: file:line: rule: message).
-x, --skip-list SKIP_LIST- Only check rules whose id/tags do not match these values.
-w, --warn-list WARN_LIST- Only warn about these rules (default: experimental, jinja[spacing], fqcn[deep]).
-L, --list-rules- List all the rules.
--offline- Disable installation of requirements.yml and schema refreshing.
--version- Show the version and the ansible-core it uses.
Examples
$ ansible-lintthe whole project, auto-detected
$ ansible-lint site.ymlone playbook
$ ansible-lint --profile productionthe strictest profile
$ ansible-lint -pone line per violation (for CI annotations)
Gotchas
- Exit code 2 = violations that are fatal; 0 = passed (warnings allowed).
- Silence one finding with
# noqa: rule-idon the line; whole rules with skip_list in .ansible-lint. - Profiles build on each other: min < basic < moderate < safety < shared < production.
Taught in
Try ansible-lint in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.