Skip to content

Commit

Permalink
Configure sudo in separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristgit committed May 12, 2024
1 parent 8379db5 commit 8a4c9b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ansible/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,23 @@
tags:
- role::common

- name: Add sudoers lecture path
- name: Configure sudo
template:
src: sudoers.j2
dest: /etc/sudoers.d/pydis
owner: root
group: root
mode: '0440'
validate: /usr/sbin/visudo -cf %s
tags:
- role::common

- name: Remove sudoers lecture path
lineinfile:
dest: /etc/sudoers
regexp: '^Defaults +?lecture_file ?= ?".+?"$'
line: 'Defaults lecture_file = "/etc/sudo_lecture"'
state: present
state: absent
validate: /usr/sbin/visudo -cf %s
tags:
- role::common
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/common/templates/sudoers.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Defaults lecture_file="/etc/sudo_lecture"
Defaults insults

# vim: ft=sudoers.j2:

0 comments on commit 8a4c9b5

Please sign in to comment.