dotfiles-ansible/roles/system/tasks/user/sudo.yml

24 lines
616 B
YAML

---
- name: user | Allow wheel group to run commands as root
community.general.sudoers:
name: allow-wheel-group
group: wheel
commands: ALL
host: ALL
runas: ALL:ALL
validation: required
nopassword: false
state: present
- name: user | Allow running commands as root without password for user {{ username }}
community.general.sudoers:
name: allow-{{ username }}-user
user: '{{ username }}'
commands: '{{ nopasswd_commands | list }}'
host: ALL
runas: ALL:ALL
validation: required
nopassword: true
state: present
when: nopasswd_commands | length > 0