Difference between revisions of "Ansible-lint"
Jump to navigation
Jump to search
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{lc}} | ||
<code>ansible-lint</code> checks [[playbooks]] for practices and behaviour that could potentially be improved. As a community backed project ansible-lint supports only the last two major versions of Ansible. | <code>ansible-lint</code> checks [[playbooks]] for practices and behaviour that could potentially be improved. As a community backed project ansible-lint supports only the last two major versions of Ansible. | ||
− | + | * macOS: <code>[[brew install ansible-lint]]</code> | |
+ | * Ubuntu: <code>[[apt install ansible-lint]]</code> | ||
+ | |||
+ | ansible-lint your-playbook.yml | ||
+ | We were unable to read either as JSON nor YAML, these are the errors we got from each: | ||
+ | JSON: Expecting value: line 2 column 1 (char 1) | ||
+ | |||
+ | Syntax Error while loading YAML. | ||
+ | [[mapping values are not allowed in this context]] | ||
+ | |||
+ | The error appears to be in '/home/ubuntu/your-playbook.yml': line 9, column 34, but may | ||
+ | be elsewhere in the file depending on the exact syntax problem. | ||
+ | |||
+ | The offending line appears to be: | ||
+ | |||
+ | - name: Add a user to a password file and ensure permissions are set | ||
+ | community.general.[[htpasswd]]: | ||
+ | ^ here | ||
== Related commands == | == Related commands == | ||
− | * [[go]] | + | * <code>[[go fmt]]</code> |
− | + | * <code>[[terraform fmt]]</code> | |
− | + | * [[AWS CloudFormation Linter]] | |
== See also == | == See also == | ||
* {{Ansible}} | * {{Ansible}} | ||
+ | * {{lint}} | ||
[[Category:Ansible]] | [[Category:Ansible]] |
Latest revision as of 14:50, 11 August 2022
ansible-lint
checks playbooks for practices and behaviour that could potentially be improved. As a community backed project ansible-lint supports only the last two major versions of Ansible.
- macOS:
brew install ansible-lint
- Ubuntu:
apt install ansible-lint
ansible-lint your-playbook.yml We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 2 column 1 (char 1) Syntax Error while loading YAML. mapping values are not allowed in this context The error appears to be in '/home/ubuntu/your-playbook.yml': line 9, column 34, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: Add a user to a password file and ensure permissions are set community.general.htpasswd: ^ here
Related commands[edit]
See also[edit]
- Ansible: modules, plugins, Playbooks (examples)
ansible-playbook
,ansible-vault
,ansible-inventory
,ansible-config
, Ansible Tower, Ansible Galaxy (Roles) (ansible-galaxy
),ansible-cmdb
,gather facts
,ansible.cfg
,Ansible Molecule
, Ansible collections,register
,template
,--ask-pass
,--ask-become-pass
,remote_user:
,/etc/ansible/hosts
,ansible-doc
,ansible-lint
,.ansible/
,--forks
,--start-at-task
,changelog
,inventory
,Notify:
,ansible HOSTNAME -m ping
,gathering
,/usr/bin/ansible
,ansible -m ping
,ansible.builtin
,hosts: (Ansible)
,set fact:
,when:
,blockinfile:
,become method:
,include:
,git:
, AWX,ansible --help
, Tags, Ansible variables, versions - Lint,
pylint
,eslint, tflint
,cfn-lint
,autopep8
,lint-staged
,autopep8 --help
, GitLab CI lint, Code climate, Black,hadolint
, KubeLinter,hlint, ansible-lint
Advertising: