sudoer.yml 491 Bytes
Newer Older
julian.gethmann's avatar
julian.gethmann committed
1 2
---
- name: Ensure sudo is installed
3
  package: pkg=sudo state=installed
julian.gethmann's avatar
julian.gethmann committed
4 5 6 7
  become: yes

- name: Copy sudoers file including validation
  become: yes
julian.gethmann's avatar
julian.gethmann committed
8 9
  template: src=sudoers.j2 dest=/etc/sudoers.d/sudoers validate='visudo -cf %s' backup=yes owner=root group=root mode=0440
  notify: lock root user
julian.gethmann's avatar
julian.gethmann committed
10 11 12 13

- name: requiretty in sudoers
  lineinfile: backup=yes regexp="Defaults    !?requiretty" state=present dest=/etc/sudoers line="Defaults    !requiretty" validate="visudo -c -f %s"
  become: yes