1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_users.git synced 2024-08-16 10:29:50 +02:00
ansible_collection_users/roles/admin/tasks/users.yml

27 lines
872 B
YAML
Raw Normal View History

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) }}"
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 }}"
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