feat(system_baseline): add inputs that append packages to the profile's lists
Build / build (pull_request) Successful in 1m15s
Lint / lint (pull_request) Successful in 5m37s
Molecule / molecule (pull_request) Successful in 7m20s

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
This commit is contained in:
Dragonish committed 2026-11-26 22:25:36 +00:00
1 parent aa4e8c68a7
commit d5a91520df
12 files changed
+269 -14

No files matched your search

+15 -1
View File
@@ -21,7 +21,8 @@ system_baseline_update: true
# Upper bound of the persistent journal (journald SystemMaxUse); older archived files are removed above it.
system_baseline_journal_max_use: 200M
# Attach an interactive SSH login to a tmux session (see tasks/tmux.yml). Off by default: it changes what every login does.
# Only the ubuntu_lxc and ubuntu_vm profiles honour it; pve never installs the snippet.
# Installed only when tmux is among the packages to install: the ubuntu_lxc and ubuntu_vm profiles have it, the pve profile has none unless
# system_baseline_extra_packages adds it.
system_baseline_tmux_autostart: false
# Name of the session an SSH login attaches to.
system_baseline_tmux_session: main
@@ -246,6 +247,19 @@ system_baseline_profile: >-
# Inputs the tasks read
system_baseline_essential_packages: "{{ system_baseline_profile.essential_packages }}"
system_baseline_remove_packages: "{{ system_baseline_profile.remove_packages }}"
# Packages installed and purged in addition to the two resolved lists above. They append: a flat essential or remove input replaces its
# list, so adding one package that way means repeating the whole profile list.
system_baseline_extra_packages: []
system_baseline_extra_remove_packages: []
# What the role acts on: each resolved list plus its extras, without duplicates. Internal, read by tasks/packages.yml, tasks/tmux.yml and
# tasks/main.yml, so that an extra `tmux` or `unattended-upgrades` enables the matching task like a profile package does.
# A flat input that is a plain string (`system_baseline_essential_packages: vim`, which the package module accepts) counts as a one-item list.
__system_baseline_install_packages: >-
{{ (([system_baseline_essential_packages] if system_baseline_essential_packages is string else system_baseline_essential_packages)
+ system_baseline_extra_packages) | unique | list }}
__system_baseline_purge_packages: >-
{{ (([system_baseline_remove_packages] if system_baseline_remove_packages is string else system_baseline_remove_packages)
+ system_baseline_extra_remove_packages) | unique | list }}
system_baseline_apt_periodic_settings: "{{ system_baseline_profile.apt_periodic_settings }}"
# safe or dist (see the profiles). Guarded: the tasks_from: update entry point needs no system_baseline_system_type, and without one it
# stays on a safe upgrade instead of failing on the profile lookup. default('safe'): a system_baseline_profiles written before this key