This is the rule-set I use for my ansible roles. By linting the roles and playbooks you get an standarized setup and use best practices.
You need to have ansible-lint installed:
$ pip install ansible-lintCheck the rules out to a directory of your choice:
$ hub clone lxhunter/ansible-lint /usr/local/src/ansible-lint
# or
$ git clone https://github.com/lxhunter/ansible-lint.git /usr/local/src/ansible-lintPro-Tip: I use fresh for this:
$ fresh lxhunter/ansible-lint . --file=/usr/local/src/ansible-lintNow you can lint your playbooks by doing:
# just my rules
$ ansible-lint -r /usr/local/src/ansible-lint/rules playbook.yml
# or for the standard rule and mine
$ ansible-lint -R -r /usr/local/src/ansible-lint/rules playbook.yml
# geek| Code | Message |
|---|---|
| LX1 | Playbook |
| --- | |
| LX2 | Role |
| --- | |
| LX3 | Task |
| --- | |
| LX4 | General Module |
| LX401 | Specific Modules should have owner, group and mode |
| --- | |
| LX5 | Specific Module |
| LX501 | Template Module - Template files should have the extension '.j2' |
You need to have nodemon installed:
$ npm installI used node for testing:
nodemon LX401Author:: Alexander Jäger
Copyright 2018