Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion roles/sudo/files/wheel_group

This file was deleted.

25 changes: 15 additions & 10 deletions roles/sudo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@
with_dict: '{{ users }}'
when: '"admin" in item.value.groups'

- name: enable sudoers.d support
- name: allow wheel group to use sudo
lineinfile:
path: /etc/sudoers
line: '#includedir /etc/sudoers.d'
dest: /etc/sudoers
state: present
regexp: '^%wheel ALL=\(ALL\) ALL'
insertafter: '^# %wheel ALL=\(ALL\) ALL'
line: '%wheel ALL=(ALL) ALL'
validate: 'visudo -cf %s'

- name: install sudo rule
copy:
src: wheel_group
dest: /etc/sudoers.d/wheel_group
mode: 0644
owner: root
group: root
- name: secure path to protect against attacks
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/bin"'
insertafter: '^# Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"'
line: 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/bin"'
validate: 'visudo -cf %s'