From a4c63ca0b3c7479c63ce114053d86158bfcc26b3 Mon Sep 17 00:00:00 2001 From: Ionut Pruteanu Date: Thu, 21 Sep 2023 10:54:41 +0300 Subject: [PATCH] Adjusting command for identifying interactive users in prelim task Signed-off-by: Ionut Pruteanu --- tasks/prelim.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/prelim.yml b/tasks/prelim.yml index e241681f..d7b304e3 100644 --- a/tasks/prelim.yml +++ b/tasks/prelim.yml @@ -153,7 +153,8 @@ - always - name: "PRELIM | Interactive User accounts" - ansible.builtin.shell: 'cat /etc/passwd | grep -Ev "nologin|/sbin|/bin" | cut -d: -f6' + ansible.builtin.shell: > + grep -E -v '^(root|halt|sync|shutdown)' /etc/passwd | awk -F: '($7 != "'"$(which nologin)"'" && $7 != "/bin/false") { print $6 }' changed_when: false register: interactive_users_home tags: