Add sudo role for Unix systems

This commit is contained in:
Kenneth Benzie 2022-11-07 14:16:19 +00:00
parent bebe6de7cd
commit 7ec59f8c52
3 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,9 @@
- hosts: localhost - hosts: localhost
roles: roles:
- role: sudo
when: ansible_user_id != "root"
- role: zsh - role: zsh
- role: neovim - role: neovim
- role: tmux - role: tmux

View File

@ -0,0 +1,12 @@
---
- assert:
that: ansible_user_id != "root"
- name: create /etc/sudoers.d/{user} config file
become: true
template:
src: sudoers
dest: '/etc/sudoers.d/{{ansible_user_id}}'
owner: root
group: root
mode: '0440'

View File

@ -0,0 +1 @@
{{ansible_user_id}} ALL=(ALL) NOPASSWD:ALL