HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

ansible-lint — Apply rules and follow best practices with your automation content. More information: <https://docs.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandansible-lintandapplyclifollowbestrules

Problem

How to use the ansible-lint command: Apply rules and follow best practices with your automation content. More information: <https://docs.ansible.com/projects/lint/>.

Solution

ansible-lint — Apply rules and follow best practices with your automation content. More information: <https://docs.ansible.com/projects/lint/>.

Lint a specific playbook and a role directory:
ansible-lint {{path/to/playbook_file}} {{path/to/role_directory}}


Lint a playbook while excluding specific rules:
ansible-lint {{[-x|--exclude-rules]}} {{rule1,rule2,...}} {{path/to/playbook_file}}


Lint a playbook in offline mode and format output as PEP8:
ansible-lint {{[-o|--offline]}} {{[-p|--parseable]}} {{path/to/playbook_file}}


Lint a playbook using a custom rules directory:
ansible-lint {{[-r|--rules]}} {{path/to/custom_rules_directory}} {{path/to/playbook_file}}


Lint all Ansible content recursively in a given directory:
ansible-lint {{path/to/project_directory}}

Code Snippets

Lint a specific playbook and a role directory

ansible-lint {{path/to/playbook_file}} {{path/to/role_directory}}

Lint a playbook while excluding specific rules

ansible-lint {{[-x|--exclude-rules]}} {{rule1,rule2,...}} {{path/to/playbook_file}}

Lint a playbook in offline mode and format output as PEP8

ansible-lint {{[-o|--offline]}} {{[-p|--parseable]}} {{path/to/playbook_file}}

Lint a playbook using a custom rules directory

ansible-lint {{[-r|--rules]}} {{path/to/custom_rules_directory}} {{path/to/playbook_file}}

Lint all Ansible content recursively in a given directory

ansible-lint {{path/to/project_directory}}

Context

tldr-pages: common/ansible-lint

Revisions (0)

No revisions yet.