mirror of
https://github.com/roles-ansible/ansible_collection_users.git
synced 2024-08-16 10:29:50 +02:00
24 lines
854 B
YAML
24 lines
854 B
YAML
---
|
|
- 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) }}"
|
|
loop: "{{ _l3d_users_user__merged_users }}"
|
|
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 }}"
|
|
loop: "{{ _l3d_users_user__merged_users }}"
|
|
loop_control:
|
|
label: "user: ['{{ item.name }}']"
|
|
when: item.state | default ('present') == 'present' and not item.admin | default(false) | bool
|