Use groups to manage sudo access rather than editing sudoers file

This commit is contained in:
Jake Howard 2022-01-22 20:01:07 +00:00
parent 7e6e630808
commit 106a89d72f
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -8,7 +8,8 @@
become: true
- name: Give user sudo access
lineinfile:
path: /etc/sudoers
line: "{{ user }} ALL=(ALL) ALL"
user:
name: "{{ user }}"
groups: "{{ 'sudo' if ansible_os_family == 'Debian' else 'wheel' }}"
append: true
become: true