Add sudo role for Unix systems
This commit is contained in:
12
roles/sudo/tasks/main.yaml
Normal file
12
roles/sudo/tasks/main.yaml
Normal 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'
|
||||
1
roles/sudo/templates/sudoers
Normal file
1
roles/sudo/templates/sudoers
Normal file
@@ -0,0 +1 @@
|
||||
{{ansible_user_id}} ALL=(ALL) NOPASSWD:ALL
|
||||
Reference in New Issue
Block a user