Set a default session and use it in case it crashes

This commit is contained in:
Kuba Orlik 2025-10-17 19:29:30 +02:00
parent 576e72e41b
commit 64370f6c0a

View File

@ -11,7 +11,16 @@
owner: "{{ ansible_user }}"
mode: "0644"
- name: Use tmux as default shell
- name: Use tmux as default shell and attach to existing session
ansible.builtin.lineinfile:
path: /root/.bashrc
line: 'case $- in *i*) [ -z "$TMUX" ] && exec tmux;; esac'
line: |
case $- in
*i*)
if command -v tmux &>/dev/null; then
if [ -z "$TMUX" ]; then
tmux attach-session -t default || tmux new-session -s default
fi
fi
;;
esac