Files
Kamino/roles/system_baseline/tasks/tmux.yml
T
Dragonish d5a91520df
Build / build (pull_request) Successful in 1m15s
Lint / lint (pull_request) Successful in 5m37s
Molecule / molecule (pull_request) Successful in 7m20s
feat(system_baseline): add inputs that append packages to the profile's lists
system_baseline_essential_packages and system_baseline_remove_packages
replace the whole list, and so does a list inside
system_baseline_profile_overrides, so adding one package meant repeating
the profile's list and keeping it in step with every release.

system_baseline_extra_packages and system_baseline_extra_remove_packages
(lists, default empty) append to the resolved lists. The tmux and
unattended-upgrades checks read the combined list, so an extra tmux or
unattended-upgrades enables the matching task like a profile package.
Items must be Debian package names: a null item would have become the
package "None", and apt reads a trailing minus (jq-) as a removal. A
package that one input installs and another purges stops the run before
any change; only overlaps that involve an extra are checked, so a
consumer's own overlap between the resolved lists behaves as before. A
flat input that is a plain string still counts as a one-item list.

With both inputs left at their default the role behaves as before.

Closes #399

Assisted-by: Claude Code:claude-sonnet-5-5
2026-11-26 22:25:36 +00:00

29 lines
1.5 KiB
YAML

---
# Attach an interactive SSH login to a tmux session, created with the configured windows when it does not exist.
# /etc/profile.d is read by every login shell: the snippet itself acts only for an interactive one with a terminal and an SSH
# connection, so scp, sftp, `ssh host command` and automation never trigger it.
# sshd's ForceCommand is deliberately not used: it applies to every session type and a broken tmux would lock out all of them.
#
# Installed when autostart is on and the packages to install hold tmux (the ubuntu_lxc and ubuntu_vm profiles, or
# system_baseline_extra_packages); the inputs are checked in validate.yml. Security: the session name, window names and commands are
# role inputs (inventory), never read from a user or a fact. They are validated and shell-quoted in the template. The script is
# root-owned and not writable by the users it runs for.
# It is world-readable and the commands show in `ps`, so a command must hold no secret. Commands run as the user who logs in.
- name: Install the tmux auto-start snippet
ansible.builtin.template:
src: tmux-autostart.sh.j2
dest: /etc/profile.d/tmux-autostart.sh
owner: root
group: root
mode: "0644"
validate: /bin/sh -n %s
when: system_baseline_tmux_autostart | bool and 'tmux' in __system_baseline_install_packages
become: true
- name: Remove the tmux auto-start snippet
ansible.builtin.file:
path: /etc/profile.d/tmux-autostart.sh
state: absent
when: not (system_baseline_tmux_autostart | bool and 'tmux' in __system_baseline_install_packages)
become: true