Commit 502c53ed authored by nimrod's avatar nimrod
Browse files

- Allow group (if defined) to use sudo without prompting for a password.

parent e9255b9d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
---
# defaults file for openbsd-bootstrap
#
openbsd_pkg_mirror: http://www.mirrorservice.org/pub # Where to get packages.
openbsd_bootstrap_sudo_group: wheel # Allow group to use sudo without prompting for a password.
+12 −1
Original line number Diff line number Diff line
@@ -37,8 +37,19 @@
    create: yes

- name: pkg install sudo
  when: ansible_distribution_release|version_compare('5.7', '>')
  when: ansible_distribution_release|version_compare('5.7', '>') and openbsd_bootstrap_sudo_group is defined
  ignore_errors: "{{ ansible_check_mode }}"
  openbsd_pkg:
      name: '{{ openbsd_bootstrap_sudo_pkg[ansible_distribution_release] }}'
      state: present

- name: Allow sudo access
  when: ansible_distribution_release|version_compare('5.7', '>') and openbsd_bootstrap_sudo_group is defined
  ignore_errors: "{{ ansible_check_mode }}"
  lineinfile:
      dest: '/etc/sudoers'
      line: '%{{ openbsd_bootstrap_sudo_group }} ALL=(ALL) NOPASSWD: ALL'
      regexp: '^%{{ openbsd_bootstrap_sudo_group }}'
      state: present
      owner: root
      group: wheel