From 4b3942754ad88efd94be59539c44a0cbcebd278b Mon Sep 17 00:00:00 2001 From: Renich Bon Ciric Date: Fri, 29 Apr 2022 12:06:01 -0500 Subject: [PATCH] fix exercise131.yaml It seems that using a template to loop through several groups in order to add sudo rights does not generate the desired state. We end up overwriting the file and, in my case, the only entry allows sudo for the students group only. If we want all groups to be added to sudo, we need to use lineinfile. --- exercise131.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercise131.yaml b/exercise131.yaml index 531733a..5ac9d11 100644 --- a/exercise131.yaml +++ b/exercise131.yaml @@ -13,9 +13,9 @@ group: "{{ item.groups }}" loop: "{{ users }}" - name: allow group members in sudo - template: - src: exercise131.j2 + lineinfile: dest: /etc/sudoers.d/sudogroups + line: "{{ item.groups }} ALL=(ALL:ALL) NOPASSWD:ALL" validate: 'visudo -cf %s' mode: 0440 loop: "{{ users }}"