Files
ansible-role-sudo/tasks/verify_vars.yaml
T
volker.raschekandCopilot 7c76a5cc86 fix(tasks): include verify_vars.yaml as tasks file
The variable verification was included via include_vars, which is meant for variable files only. Additionally the
first_found lookup had no paths defined, so it searched the files/ subdirectory and the role root instead of tasks/ and
failed with "No file was found". Switching to include_tasks and adding the tasks path makes the verification run at all.

The assertion itself was fully commented out and is now active, so a misconfigured entry fails early instead of being
silently skipped by all four sudoers tasks.

Co-authored-by: Copilot <copilot@github.com>
2026-09-10 21:41:34 +02:00

13 lines
405 B
YAML

---
- name: Verify that each entry defines either a user or a group
ansible.builtin.assert:
that:
- (item.user is defined and item.user | length > 0) !=
(item.group is defined and item.group | length > 0)
fail_msg: >
Each entry of sudo_users_sudoers must define either 'user' or 'group',
but not both and not none.
quiet: true
with_items: "{{ sudo_users_sudoers }}"