ansible-tmux/tasks/main.yml

27 lines
604 B
YAML

---
- name: Ensure tmux is installed
package:
name: tmux
state: present
- name: Copy tmux config with mouse support
copy:
src: tmux.conf
dest: "/etc/tmux.conf"
owner: "{{ ansible_user }}"
mode: "0644"
- name: Use tmux as default shell and attach to existing session
ansible.builtin.lineinfile:
path: /root/.bashrc
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