This test scans all roles/*/meta/main.yml for meta dependencies that are
likely unnecessary and could be replaced with guarded include_role/import_role
calls to improve performance.
A dependency is flagged as unnecessary when:
- The consumer role does not use provider variables in defaults/vars/handlers
(no early variable requirement), and
- Any usage of provider variables or handler notifications in tasks occurs
only after an explicit include/import of the provider in the same file,
or there is no usage at all.
Purpose:
Helps reduce redundant parsing/execution of roles and improves Ansible
performance by converting heavy global dependencies into conditional,
guarded includes where possible.
https://chatgpt.com/share/689a59ee-52f4-800f-8349-4f477dc97c7c
This test scans all .yml/.yaml files under any tasks/ directory and flags cases where the same
'when' condition appears on more than 3 tasks in the same file. Excessive duplication of identical
conditions can harm Ansible performance because the condition is re-evaluated for every task.
The test suggests replacing repeated conditions with an include_tasks call or a block guarded
by the condition to evaluate it only once.
https://chatgpt.com/share/6899c605-6f40-800f-a954-ccb62f8bbcf1
Updated test_mode_reset.py to also validate roles that contain a reset
task file (*_reset.yml or reset.yml) even when no mode_reset keyword is
found. The test now:
- Detects roles with reset files but no include, and fails accordingly.
- Ignores commented include_tasks and when lines.
- Ensures exactly one non-commented include of the reset file exists.
- Requires that the include is guarded in the same task block by a
when containing mode_reset | bool (with optional extra conditions).
This prevents silent omissions of reset task integration.
https://chatgpt.com/share/6899b745-7150-800f-98f3-ca714486f5ba