From 625308a3b4a14575a0bbe5afb70e486502725e58 Mon Sep 17 00:00:00 2001 From: William Bradford Clark Date: Wed, 31 Aug 2022 15:17:17 -0400 Subject: [PATCH] Use community.general.sudoers for unprivileged_user sudoers control --- roles/unprivileged_user/tasks/main.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/roles/unprivileged_user/tasks/main.yml b/roles/unprivileged_user/tasks/main.yml index 5fbf513d5..82f1b00a9 100644 --- a/roles/unprivileged_user/tasks/main.yml +++ b/roles/unprivileged_user/tasks/main.yml @@ -18,13 +18,10 @@ become: true - name: "Grant passwordless sudo via {{ unprivileged_user_groupname }} group" - ansible.builtin.lineinfile: - dest: "/etc/sudoers.d/{{ unprivileged_user_groupname }}" - state: present - regexp: '^%{{ unprivileged_user_groupname }}' - line: '%{{ unprivileged_user_groupname }} ALL=(ALL) NOPASSWD: ALL' - validate: '/usr/sbin/visudo -cf %s' - create: yes + community.general.sudoers: + name: "{{ unprivileged_user_groupname }}" + group: "{{ unprivileged_user_groupname }}" + commands: ALL become: true - name: "Add public key to authorized_keys from Host Machine"