playbook and rol sudoers

This commit is contained in:
Ruben Blanco 2024-02-12 10:37:19 +01:00
parent 5482ea1f3a
commit 75a6bdf201
2 changed files with 27 additions and 0 deletions

12
linux-config-sudoers.yaml Normal file
View File

@ -0,0 +1,12 @@
---
- hosts: '{{ ip_addr }}'
become: yes
become_method: sudo
gather_facts: yes
tasks:
- name: "[CONFIG SUDOERS] Config sudoers"
import_role:
name: config-sudoers

View File

@ -0,0 +1,15 @@
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# configure sudo for sysadmin group
# paso1 - add sysadmin group to sudoers
- name: Add sysadmin group to sudoers
file:
path: /etc/sudoers.d/vn
state: touch
mode: u=rw,g=r,o=r
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# paso2 - add a line to /etc/sudoers.d/vn file
- name: add a line to /etc/sudoers.d/vn file
lineinfile:
path: "/etc/sudoers.d/vn"
line: "%sysadmin ALL=(ALL) NOPASSWD: ALL"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++