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:
parent
d6636d5b09
commit
2a25c840b8
1 changed files with 7 additions and 4 deletions
|
@ -9,10 +9,13 @@
|
|||
loop: "{{ user_groups }}"
|
||||
|
||||
- name: Enable sudo for "wheel" group
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/sudoers"
|
||||
regexp: '^# %wheel ALL=(ALL) ALL$'
|
||||
line: '%wheel ALL=(ALL) ALL'
|
||||
ansible.builtin.copy:
|
||||
content: "%wheel ALL=(ALL) ALL"
|
||||
dest: "/etc/sudoers.d/10-wheel"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: true
|
||||
|
||||
- name: Add user
|
||||
ansible.builtin.user:
|
||||
|
|
Loading…
Reference in a new issue