Improve su with bash function

This commit is contained in:
Mike Holloway 2024-09-20 03:48:46 -04:00
parent ca74d003ba
commit 2038ba7a77

View File

@ -27,7 +27,7 @@
lineinfile: lineinfile:
path: "/home/{{ item }}/.bashrc" path: "/home/{{ item }}/.bashrc"
regexp: '^su() ' 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 }}" loop: "{{ service_users }}"
- lineinfile: - lineinfile: