ref(user): Add sudo permissions with dropin file

Instead of changing a line in the sudoers file we just copy a new
drop-in file into the sudoers.d/ dir. Easier, less error-prone and
allows everyone to see 'who' the sudo enabled users are (since it is
world readable).
This commit is contained in:
Marty Oehme 2025-02-25 22:30:26 +01:00
parent d6636d5b09
commit 2a25c840b8
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -9,10 +9,13 @@
loop: "{{ user_groups }}" loop: "{{ user_groups }}"
- name: Enable sudo for "wheel" group - name: Enable sudo for "wheel" group
ansible.builtin.lineinfile: ansible.builtin.copy:
path: "/etc/sudoers" content: "%wheel ALL=(ALL) ALL"
regexp: '^# %wheel ALL=(ALL) ALL$' dest: "/etc/sudoers.d/10-wheel"
line: '%wheel ALL=(ALL) ALL' owner: root
group: root
mode: 0644
force: true
- name: Add user - name: Add user
ansible.builtin.user: ansible.builtin.user: