Skip to content

jparrill/ansible-lint-rules

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rules for ansible-lint

This is a rule set for ansible-lint .

How to use

  1. Install ansible-lint (ex: pip install ansible-lint)
  2. Copy or git clone on your ansible playbook repository with rules name
  3. Run ansible lint with -r rules flag (ex: ansible-lint -r rules <your playbook file>)

Rules

+------------+----------------------------------------------------------------------+ sample message | +============+======================================================================+ playbook | +------------+----------------------------------------------------------------------+ Playbook should has ".yml" extension | +------------+----------------------------------------------------------------------+ +------------+----------------------------------------------------------------------+ Role | +------------+----------------------------------------------------------------------+ Doesn't need a relative path in role | +------------+----------------------------------------------------------------------+ +------------+----------------------------------------------------------------------+ Task | +------------+----------------------------------------------------------------------+ All tasks should be named | +------------+----------------------------------------------------------------------+ Include should has tags | +------------+----------------------------------------------------------------------+ Use ":" YAML syntax when arguments are over 4 | +------------+----------------------------------------------------------------------+ Do not use local_action. use delegate_to: localhost instead | +------------+----------------------------------------------------------------------+ Variable should has space "{{ foo }}" | +------------+----------------------------------------------------------------------+

E4 Module
E401 Octal file permissions must contain leading zero
E402 Template file should has '.j2' extension
E403 Use Package module instead of Yum module
E5 Shell/Command alternative module
E501 Use chmod module
E502 Use chown module
E503 Use hostname module
E504 Use mount module
E505 Use nmcli module
E506 Use yum module with file path
E507 Use service module
E508 Use sysctl module
E509 Use ufw module
E510 Use unarchive module
E511 Shell/command module must contain creates or removes
E512 Use file module instead of mkdir, ln -s and so on
E513 Use Shell with an Openstack client command instead of os_module
E514 Use 'db sync' Openstack client command instead of openstack-db
E515 Use Package module instead of Shell or Command execution

+------------+----------------------------------------------------------------------+ Formatting | +------------+----------------------------------------------------------------------+ Trailing whitespace | +------------+----------------------------------------------------------------------+ Line too long | +------------+----------------------------------------------------------------------+ +------------+----------------------------------------------------------------------+

Why so many shell module lint?

Because user may want to use a command to correct use. Since we separete these rule, user can disable specific rule easily.

If you can manage playbook your self, consider set skip_ansible_lint tag.

License

MIT License (same as ansible-lint)

About

ansible-lint rules

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.5%
  • Makefile 0.5%