Massive user refactor

This commit is contained in:
2020-04-22 18:04:16 -06:00
parent 429dd8e5a7
commit 5a9254097e
26 changed files with 896 additions and 123 deletions

20
user/tasks/sudo.yml Normal file
View File

@@ -0,0 +1,20 @@
---
- name: Adding users sudoers.d file
file:
path: '/etc/sudoers.d/{{ user }}'
state: touch
mode: "0640" #-rw-r-----
when: 'sudogroup in user_groups'
- name: Setting user to nopasswd sudo access
lineinfile:
path: '/etc/sudoers.d/{{ user }}'
line: '{{ user }} ALL=(ALL) NOPASSWD:ALL'
#when: '"sudo" in group'
when: 'sudogroup in user_groups'
- name: Ensuring sudo is disabled if no longer in sudo group
file:
path: /etc/sudoers.d/{{ user }}
state: absent
when: 'sudogroup not in user_groups'