From 2038ba7a779584df1da2e0baf7264048be7e2118 Mon Sep 17 00:00:00 2001 From: Mike Holloway Date: Fri, 20 Sep 2024 03:48:46 -0400 Subject: [PATCH] Improve su with bash function --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index f2e7979..c3a554b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,7 +27,7 @@ lineinfile: path: "/home/{{ item }}/.bashrc" regexp: '^su() ' - line: "su() { if [[ $1 == "-" ]]; then command machinectl shell --uid "$2"; else command machinectl shell --uid "$1"; fi; }" + line: "su() { if [[ $1 == \"-\" ]]; then command machinectl shell --uid \"$2\"; else command machinectl shell --uid \"$1\"; fi; }" loop: "{{ service_users }}" - lineinfile: