Add sudo role for Unix systems
This commit is contained in:
parent
bebe6de7cd
commit
7ec59f8c52
@ -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
|
||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user