feat(system_baseline): add inputs that append packages to the profile's lists #409

Merged
Defame1297 merged 2 commits from feat/399-extra-packages into main 2026-11-26 23:08:10 +00:00
Collaborator

What and why

Closes #399

system_baseline_essential_packages and system_baseline_remove_packages replace the profile's whole list, and so does a list inside system_baseline_profile_overrides. Adding one package meant repeating the profile's list and keeping it in step with every release.

This adds system_baseline_extra_packages and system_baseline_extra_remove_packages (lists of str, default []), which append to the resolved lists:

  • tasks/packages.yml installs the resolved list plus the extras and purges the resolved remove list plus the extra removals, without duplicates. Two internal defaults, __system_baseline_install_packages and __system_baseline_purge_packages, hold the combined lists.
  • The two checks that test the package list read the combined list, so an extra tmux enables the tmux snippet and an extra unattended-upgrades enables the unattended-upgrades tasks, as a profile package does.
  • tasks/validate.yml refuses, before any change, an item that is not a Debian package name and a package that one input installs and another purges. Only overlaps that involve an extra are checked, so a consumer's own overlap between the resolved lists behaves as before.
  • argument_specs, README (table, a section "Adding packages to a profile", the tmux note, the Tests list) and a minor_changes fragment.

With both inputs at their default the role behaves as before (the resolved lists of all three profiles pass through unique unchanged: none has a duplicate).

Beyond the proposal in the issue, three decisions you may want to look at:

  • Package-name check. The issue says "list of str". The role refuses an item that is not a Debian package name (^[a-z0-9][a-z0-9+.-]*[a-z0-9+.]$): jq- would otherwise reach apt as "remove jq", a null item would become the package None, and a version pin or a glob is out of scope. If you want it looser, it is one regex in tasks/validate.yml.
  • pve and tmux. An extra tmux on the pve profile with system_baseline_tmux_autostart: true now installs the snippet, which the README said never happened. It is a double opt-in (autostart defaults to false) and is the same as a flat package list with tmux in it today. The README and the spec now say so; there is no pve refusal.
  • A flat string. system_baseline_essential_packages: vim (the package module accepts a string) counts as a one-item list instead of failing on the new +.

Verified

  • All commit-stage hooks passed locally (ansible-lint, yamllint, changelog fragments lint, REUSE, Conventional Commit, Assisted-by).
  • The scenario's pure plays, run on localhost with ansible-core 2.22.0 in check mode against this branch: 11 refusal cases (8 bad items, 3 overlaps) each stop with the expected message, and the profile-resolution plays, the "extras append" play and the flat-string play pass (ok=214 failed=0 rescued=14; the 14 rescued are these 11 and the 3 existing blacklist cases).
  • With the overlap check removed from a copy, the same plays fail at the first overlap case, so the refusal tests do bite.
  • An independent read-only review found the sweep of readers complete, the entry points update and reboot untouched, and the Found: [...] message rendering; its findings (the flat string, three stale README/spec/defaults statements, the loose item pattern) are fixed in this commit.

Not verified

  • Molecule: it runs only in CI. In particular nothing here proves that jq is installed and ed is purged on both images. prepare.yml makes jq absent and ed present first, so the effect is the role's. ed is a guess for a package on no profile list that is safe to purge on noble and resolute; if the first run shows a dependency on it, the test needs another package.
  • An extra unattended-upgrades is only asserted at the list level (__system_baseline_install_packages), not by running the unattended-upgrades tasks; the tmux gate is run for real.
  • Behaviour on an ansible-core older than the pinned 2.22.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none. (None.)

Assisted-by: Claude Code:claude-sonnet-5-5

## What and why Closes #399 `system_baseline_essential_packages` and `system_baseline_remove_packages` replace the profile's whole list, and so does a list inside `system_baseline_profile_overrides`. Adding one package meant repeating the profile's list and keeping it in step with every release. This adds `system_baseline_extra_packages` and `system_baseline_extra_remove_packages` (lists of str, default `[]`), which append to the resolved lists: - `tasks/packages.yml` installs the resolved list plus the extras and purges the resolved remove list plus the extra removals, without duplicates. Two internal defaults, `__system_baseline_install_packages` and `__system_baseline_purge_packages`, hold the combined lists. - The two checks that test the package list read the combined list, so an extra `tmux` enables the tmux snippet and an extra `unattended-upgrades` enables the unattended-upgrades tasks, as a profile package does. - `tasks/validate.yml` refuses, before any change, an item that is not a Debian package name and a package that one input installs and another purges. Only overlaps that involve an extra are checked, so a consumer's own overlap between the resolved lists behaves as before. - argument_specs, README (table, a section "Adding packages to a profile", the tmux note, the Tests list) and a `minor_changes` fragment. With both inputs at their default the role behaves as before (the resolved lists of all three profiles pass through `unique` unchanged: none has a duplicate). Beyond the proposal in the issue, three decisions you may want to look at: - **Package-name check.** The issue says "list of str". The role refuses an item that is not a Debian package name (`^[a-z0-9][a-z0-9+.-]*[a-z0-9+.]$`): `jq-` would otherwise reach apt as "remove jq", a null item would become the package `None`, and a version pin or a glob is out of scope. If you want it looser, it is one regex in `tasks/validate.yml`. - **`pve` and tmux.** An extra `tmux` on the `pve` profile with `system_baseline_tmux_autostart: true` now installs the snippet, which the README said never happened. It is a double opt-in (autostart defaults to false) and is the same as a flat package list with `tmux` in it today. The README and the spec now say so; there is no `pve` refusal. - **A flat string.** `system_baseline_essential_packages: vim` (the package module accepts a string) counts as a one-item list instead of failing on the new `+`. ## Verified - All commit-stage hooks passed locally (ansible-lint, yamllint, changelog fragments lint, REUSE, Conventional Commit, `Assisted-by`). - The scenario's pure plays, run on localhost with ansible-core 2.22.0 in check mode against this branch: 11 refusal cases (8 bad items, 3 overlaps) each stop with the expected message, and the profile-resolution plays, the "extras append" play and the flat-string play pass (`ok=214 failed=0 rescued=14`; the 14 rescued are these 11 and the 3 existing blacklist cases). - With the overlap check removed from a copy, the same plays fail at the first overlap case, so the refusal tests do bite. - An independent read-only review found the sweep of readers complete, the entry points `update` and `reboot` untouched, and the `Found: [...]` message rendering; its findings (the flat string, three stale README/spec/defaults statements, the loose item pattern) are fixed in this commit. ## Not verified - Molecule: it runs only in CI. In particular nothing here proves that `jq` is installed and `ed` is purged on both images. `prepare.yml` makes `jq` absent and `ed` present first, so the effect is the role's. `ed` is a guess for a package on no profile list that is safe to purge on noble and resolute; if the first run shows a dependency on it, the test needs another package. - An extra `unattended-upgrades` is only asserted at the list level (`__system_baseline_install_packages`), not by running the unattended-upgrades tasks; the tmux gate is run for real. - Behaviour on an `ansible-core` older than the pinned 2.22. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. (None.) Assisted-by: Claude Code:claude-sonnet-5-5
Dragonish added 1 commit 2026-11-26 22:27:42 +00:00
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
d5a91520df
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
Defame1297 added 1 commit 2026-11-26 22:58:49 +00:00
Merge branch 'main' into feat/399-extra-packages
Build / build (pull_request) Successful in 36s
Lint / lint (pull_request) Successful in 2m35s
Molecule / molecule (pull_request) Successful in 8m28s
40e3b39990
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-26 22:59:17 +00:00
Defame1297 merged commit 6a2060bd31 into main 2026-11-26 23:08:10 +00:00
Defame1297 deleted branch feat/399-extra-packages 2026-11-26 23:08:18 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#409