Skip to content

Commit 7203785

Browse files
hunleydCopilot
andauthored
feat: add tmux to base image and auto-launch it (#2115)
* feat: add tmux to base image and auto-launch it * Update ansible/tasks/setup-tmux.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: fixups from copilot * fix: formatting * chore: bump ami version string --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0dcd1d8 commit 7203785

4 files changed

Lines changed: 114 additions & 3 deletions

File tree

ansible/files/tmux.conf.j2

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Keep the default prefix
2+
set-option -g prefix C-b
3+
4+
# Add Ctrl-a as a second prefix
5+
set-option -g prefix2 C-a
6+
7+
# Ensure that pressing Ctrl-a twice sends the prefix to the inner application
8+
# (Useful for nested tmux sessions or programs that use Ctrl-a)
9+
bind-key C-a send-prefix -2
10+
11+
# split panes using | and -
12+
bind | split-window -h
13+
bind - split-window -v
14+
15+
# switch panes using Alt-arrow without prefix
16+
bind -n M-Left select-pane -L
17+
bind -n M-Right select-pane -R
18+
bind -n M-Up select-pane -U
19+
bind -n M-Down select-pane -D
20+
21+
# Enable mouse control (clickable windows, panes, resizable panes)
22+
set -g mouse on
23+
24+
# DESIGN TWEAKS
25+
26+
# don't do anything when a 'bell' rings
27+
set -g visual-activity off
28+
set -g visual-bell off
29+
set -g visual-silence off
30+
setw -g monitor-activity off
31+
set -g bell-action none
32+
33+
# clock mode
34+
setw -g clock-mode-colour yellow
35+
36+
# copy mode
37+
setw -g mode-style 'fg=black bg=red bold'
38+
39+
# panes
40+
set -g pane-border-style 'fg=red'
41+
set -g pane-active-border-style 'fg=yellow'
42+
43+
# statusbar
44+
set -g status-position bottom
45+
set -g status-justify left
46+
set -g status-style 'fg=red'
47+
48+
set -g status-left ''
49+
set -g status-left-length 10
50+
51+
set -g status-right-style 'fg=black bg=yellow'
52+
set -g status-right '%Y-%m-%d %H:%M '
53+
set -g status-right-length 50
54+
55+
setw -g window-status-current-style 'fg=black bg=red'
56+
setw -g window-status-current-format ' #I #W #F '
57+
58+
setw -g window-status-style 'fg=red bg=black'
59+
setw -g window-status-format ' #I #[fg=white]#W #[fg=yellow]#F '
60+
61+
setw -g window-status-bell-style 'fg=yellow bg=red bold'
62+
63+
# messages
64+
set -g message-style 'fg=yellow bg=red bold'

ansible/playbook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
- name: Install tuned
3030
import_tasks: tasks/setup-tuned.yml
3131

32+
- name: Install tmux
33+
import_tasks: tasks/setup-tmux.yml
34+
3235
- name: Install Postgres from source
3336
import_tasks: tasks/setup-postgres.yml
3437

ansible/tasks/setup-tmux.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
- name: tmux - Install tmux
2+
ansible.builtin.apt:
3+
name: 'tmux'
4+
state: 'present'
5+
update_cache: true
6+
become: true
7+
8+
- name: tmux - Configure shell auto-logout
9+
ansible.builtin.copy:
10+
content: |
11+
case "$-" in
12+
*i*) export TMOUT=600 ;;
13+
esac
14+
dest: '/etc/profile.d/11-shell_timeout.sh'
15+
group: 'root'
16+
mode: '0644'
17+
owner: 'root'
18+
become: true
19+
20+
- name: tmux - Configure tmux
21+
ansible.builtin.template:
22+
dest: '/etc/tmux.conf'
23+
group: 'root'
24+
mode: '0644'
25+
owner: 'root'
26+
src: 'files/tmux.conf.j2'
27+
become: true
28+
29+
- name: tmux - Auto-launch tmux as needed
30+
ansible.builtin.copy:
31+
content: |
32+
case "$-" in
33+
*i*)
34+
case "$TERM" in
35+
tmux*) ;;
36+
*) tmux new-session -A -s supa ;;
37+
esac
38+
;;
39+
esac
40+
dest: '/etc/profile.d/12-tmux.sh'
41+
group: 'root'
42+
mode: '0644'
43+
owner: 'root'
44+
become: true

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.064-orioledb"
14-
postgres17: "17.6.1.107"
15-
postgres15: "15.14.1.107"
13+
postgresorioledb-17: "17.6.0.064-orioledb-indata574-1"
14+
postgres17: "17.6.1.107-indata574-1"
15+
postgres15: "15.14.1.107-indata574-1"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.25.1

0 commit comments

Comments
 (0)