feat(system_baseline): add inputs that append packages to the profile's install and remove lists #399

Open
opened 2026-11-26 20:57:49 +00:00 by Dragonish · 0 comments
Collaborator

Problem

system_baseline picks a package list per system type (system_baseline_profiles.<type>.essential_packages and .remove_packages). A consumer who wants one more package than the profile (or one more removal) has no way to say only that:

  • system_baseline_essential_packages and system_baseline_remove_packages are flat inputs that replace the whole resolved list. The consumer must copy the profile's full list into inventory and keep it in step with every release that changes the profile.
  • system_baseline_profile_overrides merges recursively into the profile, but the defaults file and argument_specs.yml both say lists inside it are replaced, not merged. So profile_overrides: {ubuntu_vm: {essential_packages: [jq]}} also drops every package the profile installs today.
  • Replacing the list silently has side effects: tmux autostart is installed only when tmux is in the resolved package list, and the unattended-upgrades task runs only when unattended-upgrades is in it. A consumer who replaces the list and forgets either loses that behaviour without an error.

Out of scope: package versions, per-package state other than present/absent, repositories, and changing the profiles' own lists.

Proposal

Two optional list inputs, empty by default, appended to the resolved lists:

  • system_baseline_extra_packages (list of str, default []): installed in addition to the resolved essential_packages.
  • system_baseline_extra_remove_packages (list of str, default []): removed in addition to the resolved remove_packages.

Naming follows the role's existing system_baseline_<thing> inputs (system_baseline_essential_packages, system_baseline_remove_packages). The base inputs keep their meaning (a flat input still replaces the profile list); the extras are added on top of whichever list results.

Mechanics, in defaults/main.yml next to the other resolved inputs, so consumers of the existing names see no change:

system_baseline_extra_packages: []
system_baseline_extra_remove_packages: []

and tasks/packages.yml installs system_baseline_essential_packages + system_baseline_extra_packages | unique and loops over system_baseline_remove_packages + system_baseline_extra_remove_packages | unique. The two places that test list membership (tmux in tasks/tmux.yml, unattended-upgrades in tasks/main.yml) should test the combined list, so that an extra tmux behaves like a profile tmux.

Questions for the maintainer: (1) should a package named in both the extras install list and the remove list (base or extra) be refused in tasks/validate.yml? The proposal says yes, one assert. (2) Is a type: list/elements: str input with a default: [] in argument_specs.yml and in defaults/main.yml the preferred shape (roles/AGENTS.md "argument_specs")?

Acceptance criteria

  • system_baseline_extra_packages and system_baseline_extra_remove_packages exist in defaults/main.yml (default []) and in meta/argument_specs.yml with type: list, elements: str, a description and the same default. Check: ansible-lint (schema role-arg-spec) and ansible-doc -t role mortis.kamino.system_baseline show both.
  • With both left at default, the packages installed and removed are identical to v3.0.0 for each of ubuntu_vm, ubuntu_lxc and pve. Check: the existing molecule default scenario still passes unchanged.
  • With system_baseline_extra_packages: [jq] on ubuntu_lxc, jq is installed together with every package of the profile. Check: molecule verify asserts jq and curl (a profile package) are installed.
  • With system_baseline_extra_remove_packages: [<pkg>], that package is purged when installed, in addition to the profile's removals. Check: molecule verify asserts it is absent.
  • A package named in both the install side and the remove side stops the run before any change, naming the input. Check: a molecule "refuse" scenario in the style of refuse_reboot.yml.
  • An extra tmux or unattended-upgrades when a flat system_baseline_essential_packages override omitted it still enables the matching task. Check: molecule scenario asserts /etc/profile.d/tmux-autostart.sh exists.
  • The README variables table and "Role interface" note list both inputs; a minor_changes fragment exists in changelogs/fragments/. Check: pre-commit run --all-files (antsibull-changelog-lint).

This is the contributor's own code and is offered under GPL-3.0-or-later, the Collection's licence.

Assisted-by: Claude Code

## Problem `system_baseline` picks a package list per system type (`system_baseline_profiles.<type>.essential_packages` and `.remove_packages`). A consumer who wants one more package than the profile (or one more removal) has no way to say only that: - `system_baseline_essential_packages` and `system_baseline_remove_packages` are flat inputs that replace the whole resolved list. The consumer must copy the profile's full list into inventory and keep it in step with every release that changes the profile. - `system_baseline_profile_overrides` merges recursively into the profile, but the defaults file and `argument_specs.yml` both say lists inside it are replaced, not merged. So `profile_overrides: {ubuntu_vm: {essential_packages: [jq]}}` also drops every package the profile installs today. - Replacing the list silently has side effects: `tmux` autostart is installed only when `tmux` is in the resolved package list, and the unattended-upgrades task runs only when `unattended-upgrades` is in it. A consumer who replaces the list and forgets either loses that behaviour without an error. Out of scope: package versions, per-package state other than present/absent, repositories, and changing the profiles' own lists. ## Proposal Two optional list inputs, empty by default, appended to the resolved lists: - `system_baseline_extra_packages` (list of str, default `[]`): installed in addition to the resolved `essential_packages`. - `system_baseline_extra_remove_packages` (list of str, default `[]`): removed in addition to the resolved `remove_packages`. Naming follows the role's existing `system_baseline_<thing>` inputs (`system_baseline_essential_packages`, `system_baseline_remove_packages`). The base inputs keep their meaning (a flat input still replaces the profile list); the extras are added on top of whichever list results. Mechanics, in `defaults/main.yml` next to the other resolved inputs, so consumers of the existing names see no change: ```yaml system_baseline_extra_packages: [] system_baseline_extra_remove_packages: [] ``` and `tasks/packages.yml` installs `system_baseline_essential_packages + system_baseline_extra_packages | unique` and loops over `system_baseline_remove_packages + system_baseline_extra_remove_packages | unique`. The two places that test list membership (`tmux` in `tasks/tmux.yml`, `unattended-upgrades` in `tasks/main.yml`) should test the combined list, so that an extra `tmux` behaves like a profile `tmux`. Questions for the maintainer: (1) should a package named in both the extras install list and the remove list (base or extra) be refused in `tasks/validate.yml`? The proposal says yes, one `assert`. (2) Is a `type: list`/`elements: str` input with a `default: []` in `argument_specs.yml` and in `defaults/main.yml` the preferred shape (roles/AGENTS.md "argument_specs")? ## Acceptance criteria - [ ] `system_baseline_extra_packages` and `system_baseline_extra_remove_packages` exist in `defaults/main.yml` (default `[]`) and in `meta/argument_specs.yml` with `type: list`, `elements: str`, a description and the same `default`. Check: `ansible-lint` (schema `role-arg-spec`) and `ansible-doc -t role mortis.kamino.system_baseline` show both. - [ ] With both left at default, the packages installed and removed are identical to v3.0.0 for each of `ubuntu_vm`, `ubuntu_lxc` and `pve`. Check: the existing molecule `default` scenario still passes unchanged. - [ ] With `system_baseline_extra_packages: [jq]` on `ubuntu_lxc`, `jq` is installed together with every package of the profile. Check: molecule verify asserts `jq` and `curl` (a profile package) are installed. - [ ] With `system_baseline_extra_remove_packages: [<pkg>]`, that package is purged when installed, in addition to the profile's removals. Check: molecule verify asserts it is absent. - [ ] A package named in both the install side and the remove side stops the run before any change, naming the input. Check: a molecule "refuse" scenario in the style of `refuse_reboot.yml`. - [ ] An extra `tmux` or `unattended-upgrades` when a flat `system_baseline_essential_packages` override omitted it still enables the matching task. Check: molecule scenario asserts `/etc/profile.d/tmux-autostart.sh` exists. - [ ] The README variables table and "Role interface" note list both inputs; a `minor_changes` fragment exists in `changelogs/fragments/`. Check: `pre-commit run --all-files` (antsibull-changelog-lint). This is the contributor's own code and is offered under GPL-3.0-or-later, the Collection's licence. Assisted-by: Claude Code
Dragonish added the
Status
Ready for Human
label 2026-11-26 20:57:49 +00:00
Dragonish added
Status
Ready for Agent
and removed
Status
Ready for Human
labels 2026-11-26 21:17:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#399