From 960c45b6d751617fc42fd9c8c82b5754a4ba000c 2023-08-29 18:14:50 From: x Date: 2023-08-29 18:14:50 Subject: [PATCH] feat: initial server, colorful PS1 in global bashrc --- diff --git a/initial_server_setup/initial_setup.yml b/initial_server_setup/initial_setup.yml index 761620ff536e23ece7aac4af01639cd08b00097d..d8486a1ce248edfabb76835894c50b310d27b4cf 100644 --- a/initial_server_setup/initial_setup.yml +++ b/initial_server_setup/initial_setup.yml @@ -120,6 +120,21 @@ name: "root" shell: /bin/bash tags: users + - name: Add colorful PS1 in default bashrc + ansible.builtin.blockinfile: + path: /etc/bash.bashrc + marker: "# {mark} ANSIBLE MANAGED BLOCK / Colorful PS1" + block: | + case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; + esac + + if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + fi + unset color_prompt force_color_prompt - name: Add SSH key for users from vars ansible.posix.authorized_key: