From 8913825485d687e6b07454d7bb226a8b5d909433 Mon Sep 17 00:00:00 2001 From: binary Date: Sat, 20 Feb 2021 18:29:00 +0100 Subject: Deprecate sudo for doas/opendoas --- roles/workstation/tasks/main.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'roles/workstation/tasks') diff --git a/roles/workstation/tasks/main.yml b/roles/workstation/tasks/main.yml index 2789c9b..6b8d28f 100644 --- a/roles/workstation/tasks/main.yml +++ b/roles/workstation/tasks/main.yml @@ -16,11 +16,33 @@ set_fact: ansible_become_method: "{{ 'doas' if ws_become.stat.exists else 'sudo' }}" ansible_become_user: root - ws_user: ws_user.results.stdout + ws_user: "{{ ws_user.stdout }}" - name: include distribution specific task include_tasks: "_{{ ansible_distribution | lower }}.yml" ignore_errors: true +- name: generate doas configuration + lineinfile: + path: /etc/doas.conf + regexp: "^permit persist keepenv {{ ws_user }} as root" + line: "permit persist keepenv {{ ws_user }} as root" + owner: root + mode: 0644 + create: true + +- name: check sudo binary path + shell: which sudo + register: sudo + ignore_errors: true + +- name: uninstall sudo binary + package: + name: sudo + state: absent + when: sudo.rc == 0 + register: sudo + ignore_errors: true + - name: setup dotfiles from upstream and user script meta: end_host -- cgit v1.2.3