2024-02-14 22:51:50 +01:00
|
|
|
---
|
|
|
|
- name: Give admins superpower
|
|
|
|
become: true
|
|
|
|
community.general.sudoers:
|
2024-02-18 15:44:57 +01:00
|
|
|
name: "{{ user.name }}-superpowers"
|
|
|
|
user: "{{ user.name }}"
|
2024-02-14 22:51:50 +01:00
|
|
|
state: 'present'
|
2024-02-18 15:44:57 +01:00
|
|
|
commands: "{{ user.admin_commands | default('ALL') }}"
|
|
|
|
nopassword: "{{ user.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:
|
2024-02-18 15:44:57 +01:00
|
|
|
label: "user={{ user.name }}"
|
|
|
|
loop_var: user
|
2024-03-22 16:40:22 +01:00
|
|
|
when: user.state | default ('present') == 'present' and user.admin | default(false) | bool
|
2024-02-14 22:51:50 +01:00
|
|
|
|
|
|
|
- name: Remove superpowers from Users
|
|
|
|
become: true
|
|
|
|
community.general.sudoers:
|
2024-02-18 15:44:57 +01:00
|
|
|
name: "{{ user.name }}-superpowers"
|
2024-02-14 22:51:50 +01:00
|
|
|
state: 'absent'
|
2024-02-18 15:44:57 +01:00
|
|
|
user: "{{ user.name }}"
|
2024-02-15 00:25:34 +01:00
|
|
|
loop: "{{ _l3d_users__merged_users }}"
|
2024-02-14 22:51:50 +01:00
|
|
|
loop_control:
|
2024-02-18 15:44:57 +01:00
|
|
|
label: "user={{ user.name }}"
|
|
|
|
loop_var: user
|
|
|
|
when: user.state | default ('present') == 'present' and not user.admin | default(false) | bool
|