/ansible-tmux

An Ansible role for installing and configuring tmux

MIT LicenseMIT

tmux

This is an Ansible role for installing and configuring tmux. It installs a fancy .tmux.conf that greatly increases usability, including the Tmux Plugin Manager and tmux-resurrect so that you don't have to "quit" tmux when you power off your machine.

It also ensures that history is shared between tmux windows using this method. Finally, it adds some aliases to .bashrc to make managing tmux easier.

Installation

sudo ansible-galaxy install kylebebak.tmux
# to update
sudo ansible-galaxy install kylebebak.tmux --force

Variables

update: false
install: true

tmux_config: true
tmux_upgrade: true
tmux_plugin_manager: true
tmux_plugins:
  - set -g @plugin 'tmux-plugins/tmux-resurrect'

share_history: true
aliases: true

Usage

This role can install tmux version 2.0, which is necessary if you include the Tmux Plugin Manager. This installation is only tested on Ubuntu. Installing v2.0 requires execution as sudo, so if you include tmux_upgrade, you should invoke ansible-playbook with --ask-sudo-pass.

Otherwise, playbooks including this role don't have to elevate to sudo, because the role only modifies files in the login user's home directory.

# playbooks/tmux.yml
- hosts: all
  become: yes

  roles:
    - role: kylebebak.tmux
      tags: [tmux]
ansible-playbook -u {user} -i {inventory} playbooks/tmux.yml

License

This code is licensed under the MIT License.