2021-04-09 23:29:03 +02:00
|
|
|
---
|
2020-08-18 11:57:53 +02:00
|
|
|
- name: install tmux packages
|
|
|
|
become: yes
|
2021-01-02 10:30:54 +01:00
|
|
|
ansible.builtin.package:
|
2020-08-18 11:57:53 +02:00
|
|
|
name:
|
|
|
|
- tmux
|
|
|
|
state: present
|
|
|
|
cache_valid_time: 360
|
|
|
|
|
2020-12-02 14:38:06 +01:00
|
|
|
- name: Check if "{{ tmux_bashrc_destination }}" exists
|
2021-06-29 13:58:31 +02:00
|
|
|
become: yes
|
2020-12-02 14:38:06 +01:00
|
|
|
stat:
|
|
|
|
path: "{{ tmux_bashrc_destination }}"
|
|
|
|
register: stat_result
|
|
|
|
|
|
|
|
- name: touch "{{ tmux_bashrc_destination }}" , if it doesnt exist already
|
2020-11-30 09:42:26 +01:00
|
|
|
become: yes
|
|
|
|
file:
|
|
|
|
path: "{{ tmux_bashrc_destination }}"
|
|
|
|
state: touch
|
2020-12-02 14:38:06 +01:00
|
|
|
when: not stat_result.stat.exists
|
2020-08-18 11:57:53 +02:00
|
|
|
|
|
|
|
- name: add tmux-session config to .bashrc
|
|
|
|
become: yes
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.blockinfile:
|
2020-08-18 11:57:53 +02:00
|
|
|
path: "{{ tmux_bashrc_destination }}"
|
|
|
|
block: |
|
|
|
|
if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
|
|
|
|
tmux attach -t {{ tmux_standardsession_name }} || tmux new -s {{ tmux_standardsession_name }}
|
|
|
|
fi
|