aboutsummaryrefslogblamecommitdiffstats
path: root/roles/workstation/tasks/doas.yml
blob: bc72d7f025a4d2c2e02ce6023e3fb159bcc3abcd (plain) (tree)

































                                                                          
- name: generate doas configuration
  lineinfile:
    path: /etc/doas.conf
    regexp: "^permit persist keepenv {{ workstation_user }} as root"
    line: "permit persist keepenv {{ workstation_user }} as root"
    create: true
    mode: 0644
    owner: 0
    group: 0

- name: allow reboot/shutdown/hibernate with doas
  lineinfile:
    path: /etc/doas.conf
    regexp: "^permit nopass {{ workstation_user }} as root cmd {{ item }}"
    line: "permit nopass {{ workstation_user }} as root cmd {{ item }}"
  loop:
    - ZZZ
    - mount
    - reboot
    - shutdown
    - zzz

- name: check sudo binary path  # noqa no-changed-when
  command: command -v sudo
  register: result
  failed_when: false

- name: uninstall sudo binary
  package:
    name: sudo
    state: absent
  when: result.rc == 0
  register: sudo
  ignore_errors: true
remember that computers suck.