homeserver/roles/mgrote.tmux/tasks/main.yml

30 lines
832 B
YAML
Raw Normal View History

---
2020-08-18 11:57:53 +02:00
- name: install tmux packages
become: yes
ansible.builtin.package:
2020-08-18 11:57:53 +02:00
name:
- tmux
state: present
cache_valid_time: 360
- name: Check if "{{ tmux_bashrc_destination }}" exists
stat:
path: "{{ tmux_bashrc_destination }}"
register: stat_result
- name: touch "{{ tmux_bashrc_destination }}" , if it doesnt exist already
become: yes
file:
path: "{{ tmux_bashrc_destination }}"
state: touch
when: not stat_result.stat.exists
2020-08-18 11:57:53 +02:00
- name: add tmux-session config to .bashrc
become: yes
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