homeserver/roles/mgrote.tmux/tasks/main.yml
mg e9f78f93eb Ersetze ansible.builtin.apt module durch ansible.builtin.package (#20)
Bugfix: acng

ansible.builtin.apt --> ansible.builtin.package

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#20
Co-Authored-By: mg <michael.grote@posteo.de>
Co-Committed-By: mg <michael.grote@posteo.de>
2021-01-02 10:30:54 +01:00

29 lines
828 B
YAML

- name: install tmux packages
become: yes
ansible.builtin.package:
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
- name: add tmux-session config to .bashrc
become: yes
ansible.builtin.blockinfile:
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