aboutsummaryrefslogblamecommitdiffstats
path: root/roles/_workstation/doas/tasks/main.yml
blob: 4f22fe5dd43c45254b8d2a1b553fd4abc013ef18 (plain) (tree)
1
2
3
4
5
6
7
8
9

   
                                   
                             


                                                                         
                
                



                                                 
                             


                                                                               







                                                      
                                          



                             
                          




                      
---

- name: generate doas configuration
  ansible.builtin.lineinfile:
    path: "{{ doas_configuration_file }}"
    regexp: "^permit persist keepenv {{ doas_workstation_user }} as root"
    line: "permit persist keepenv {{ doas_workstation_user }} as root"
    create: true
    mode: "0644"
    owner: 0
    group: 0

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

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

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