2024-02-14 22:51:50 +01:00
|
|
|
---
|
|
|
|
- name: Give admins superpower
|
|
|
|
become: true
|
|
|
|
community.general.sudoers:
|
|
|
|
name: "{{ item.name }}-superpowers"
|
|
|
|
user: "{{ item.name }}"
|
|
|
|
state: 'present'
|
|
|
|
commands: "{{ item.admin_commands | default('ALL') }}"
|
|
|
|
nopassword: "{{ item.admin_nopassword | default(false) }}"
|
2024-02-15 00:25:34 +01:00
|
|
|
loop: "{{ _l3d_users__merged_users }}"
|
2024-02-14 22:51:50 +01:00
|
|
|
loop_control:
|
|
|
|
label: "user: ['{{ item.name }}']"
|
|
|
|
when: item.state | default ('present') == 'present' and item.admin | default(false) | bool
|
|
|
|
|
|
|
|
- name: Remove superpowers from Users
|
|
|
|
become: true
|
|
|
|
community.general.sudoers:
|
|
|
|
name: "{{ item.name }}-superpowers"
|
|
|
|
state: 'absent'
|
|
|
|
user: "{{ item.name }}"
|
2024-02-15 00:25:34 +01:00
|
|
|
loop: "{{ _l3d_users__merged_users }}"
|
2024-02-14 22:51:50 +01:00
|
|
|
loop_control:
|
|
|
|
label: "user: ['{{ item.name }}']"
|
|
|
|
when: item.state | default ('present') == 'present' and not item.admin | default(false) | bool
|