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 }}"
|
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:
|
||||||
|
|
Loading…
Reference in a new issue