Files
computer-playbook/tests/lint/ansible/modules/README.md
kevinveenbirkenbach a3402eac5b test(lint): group ansible lints into per-concern subdirs + add dotted-path test
Restructures tests/lint/ansible/ into five concern-keyed subdirectories
(jinja/, modules/, services/, shell/, sql/) plus the pre-existing roles/
and variables/. Each new subdir ships its own __init__.py exporting
PROJECT_ROOT and a scope-focused README.md following the project's
documentation conventions (RFC 2119 keywords, emoji-after-headline,
one-sentence-per-line, no historical context).

12 existing tests move into their concern bucket via git mv so history
follows the file. Adds tests/lint/ansible/variables/test_dotted_path_keys_exist.py
which catches the bug class where a Jinja dotted path's head resolves
via group_vars/all/ or the consuming role's own vars/defaults but a
deeper segment does not exist as a key in the dict tree (e.g. the
previous `LDAP.SERVER.REACH_DOMAIN` typo in web-app-odoo).

Touches three external references so cross-links keep resolving:
- docs/contributing/actions/testing/suppression.md (run-once, shared)
- roles/sys-svc-compose/tasks/utils/network/README.md (network-via-util)
- tests/lint/ansible/sql/test_no_inline_multiline_sql.py (self-path exclude)
2026-05-14 17:12:56 +02:00

1.5 KiB

Ansible Module Lints 🔧

Lint tests that enforce correct Ansible module usage and task-level invariants. Each test catches a class of silent or confusing failure that the runtime would otherwise tolerate or surface far from its cause.

Tests in this directory MUST only cover Ansible module / task usage rules.

  • test_network_create_via_util.py requires that role tasks creating Docker networks route through the shared utility, never inline community.docker.docker_network calls.
  • test_no_legacy_get_url_module_usage.py forbids the unqualified get_url: module name; tasks MUST use ansible.builtin.get_url.
  • test_no_legacy_uri_module_usage.py forbids the unqualified uri: module name; tasks MUST use ansible.builtin.uri.
  • test_no_literal_no_log.py forbids literal no_log: true / no_log: false; every gate MUST flow through the MASK_CREDENTIALS_IN_LOGS variable.
  • test_no_redundant_default_on_module_io.py forbids | default(...) on a task's own register: output or input arguments inside its own conditionals, where the value is provably set.
  • test_run_once_tags.py requires that every set_fact marked run_once: true carries the canonical run-once tags so re-runs and --tags filters keep the fact populated.

Shell-pipeline rules and SQL formatting rules live in sibling directories; see ../shell/ and ../sql/.

For framework, directory layout, and make test-lint usage see lint.md.