ansible-collections / ansible-consul

:satellite: Ansible role for Hashicorp Consul clusters
https://galaxy.ansible.com/ansible-community/consul/
BSD 2-Clause "Simplified" License
456 stars 316 forks source link

Improve linting for this role #509

Closed ppuschmann closed 1 year ago

ppuschmann commented 2 years ago

Improve Linting-rules

Use strict rules for ansible-lint and yamlling and ignore misleading code like molecule and GitHub-Actions.

Align truthiness values

Change the older values of yes/no to the newer consistent values of ansible-lint: true/false

Use Ansible FQCN for builtin modules

Rename all builtin modules to the matching FQCN.

Use Ansible FQCN for Windows and APK modules

Rename all Windows and APK modules to the matching FQCN.

Changes quotes + whitespaces

More simple changes to use only one styles of quotes and remove trailing whitespaces and empty lines.

Rename var "consul_autopilot_cleanup_dead_Servers"

Ensure variable consul_autopilot_cleanup_dead_Servers is matching the naming guidelines: change variable name to lower-case.

Fix/improve name casing for tasks

According to ansible-lint all task-names have to start with a capital lettter.

Restructure blocks

Use the new order for blocks. This nearly unreadble change puts all meta-data for blocks, like register, when,become` and similar attributes to the top and makes this configuration more readable.

This change also introduces names for blocks.

Improvements for jinja[spacing]

Override ansible-lint for tasks with safe-guards

There are some tasks that need to be executed in this exact order and there are tasks that are generating things, e.g. keys and secrets.

Around these tasks are safeguards that justify the implentation of the noqa statements.


I'm totally open for discussions. This single changes are separated by content, so it should be fairly simple to split this monster PR if someone is whishing for this.

ppuschmann commented 2 years ago

Just added the missing versions in version.txt.

bbaassssiiee commented 1 year ago

Could you please push and create a PR again? Tests were failing so I reverted.