feat(system_baseline): add a per-host package blacklist for unattended-upgrades #325

Merged
Defame1297 merged 3 commits from feat/322-unattended-blacklist into main 2026-11-23 20:00:04 +00:00
Collaborator

What and why

Closes #322

system_baseline had no way to keep individual packages out of unattended-upgrades, for a host whose kernel or drivers must not change (for example one with hardware passthrough). New variable system_baseline_unattended_upgrade_package_blacklist (list of regular expressions, default []). A non-empty list is written to /etc/apt/apt.conf.d/90unattended-upgrades-blacklist as Unattended-Upgrade::Package-Blacklist { ... };; an empty list removes the file. apt appends list entries across files, so the entries are added to those of 50unattended-upgrades, which is not edited.

Design choice (the issue asked, no answer yet): a separate drop-in, like the existing 90unattended-upgrades-origins, instead of a block inside the distribution's 50unattended-upgrades conffile. The variable is flat (per host), not part of a profile. Entries may not hold a double quote, a backslash or a line break (the origins rule); the value must be a list of strings, so a bare string or a null item is refused (a bare string would otherwise be split into one-character patterns, a null would become an empty pattern).

Verified

  • The template renders, and apt-config parses the rendered file as a list (Unattended-Upgrade::Package-Blacklist:: "linux-image-.*"; and "nvidia-.*").
  • The validation, with Ansible's own engine: a list of normal patterns and an empty list pass; a double quote, a backslash, an empty string, a null item, an integer item, a bare string and a mapping are refused.
  • All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit).
  • An independent review of the diff found two validation gaps (the bare string and the null item), fixed here and covered by the Molecule refusal cases.
  • The Molecule scenario adds: refusal of a quote, a null item and a bare string in converge; and in verify a play that writes a two-entry blacklist and checks apt-config dump, runs the tasks again and checks the file is not rewritten (checksum and mtime), then runs with an empty list and checks the file and the entries are gone.

Not verified

  • Molecule itself (CI only): the new refusal and verify cases have not run on the image.
  • unattended-upgrades acting on the blacklist on a real host. I checked how apt reads the file, not unattended-upgrades' own matching (the entries are regular expressions; whether they are matched from the start of the name or anywhere is why the README only says to anchor an entry that must not match longer names).
  • Like the other unattended-upgrades settings, the drop-in is only managed when unattended-upgrades is in the profile's packages (the README says so).

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

Assisted-by: Claude Code

## What and why Closes #322 `system_baseline` had no way to keep individual packages out of unattended-upgrades, for a host whose kernel or drivers must not change (for example one with hardware passthrough). New variable `system_baseline_unattended_upgrade_package_blacklist` (list of regular expressions, default `[]`). A non-empty list is written to `/etc/apt/apt.conf.d/90unattended-upgrades-blacklist` as `Unattended-Upgrade::Package-Blacklist { ... };`; an empty list removes the file. apt appends list entries across files, so the entries are added to those of `50unattended-upgrades`, which is not edited. Design choice (the issue asked, no answer yet): a separate drop-in, like the existing `90unattended-upgrades-origins`, instead of a block inside the distribution's `50unattended-upgrades` conffile. The variable is flat (per host), not part of a profile. Entries may not hold a double quote, a backslash or a line break (the origins rule); the value must be a list of strings, so a bare string or a `null` item is refused (a bare string would otherwise be split into one-character patterns, a `null` would become an empty pattern). ## Verified - The template renders, and `apt-config` parses the rendered file as a list (`Unattended-Upgrade::Package-Blacklist:: "linux-image-.*";` and `"nvidia-.*"`). - The validation, with Ansible's own engine: a list of normal patterns and an empty list pass; a double quote, a backslash, an empty string, a `null` item, an integer item, a bare string and a mapping are refused. - All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit). - An independent review of the diff found two validation gaps (the bare string and the `null` item), fixed here and covered by the Molecule refusal cases. - The Molecule scenario adds: refusal of a quote, a `null` item and a bare string in converge; and in verify a play that writes a two-entry blacklist and checks `apt-config dump`, runs the tasks again and checks the file is not rewritten (checksum and mtime), then runs with an empty list and checks the file and the entries are gone. ## Not verified - Molecule itself (CI only): the new refusal and verify cases have not run on the image. - `unattended-upgrades` acting on the blacklist on a real host. I checked how apt reads the file, not unattended-upgrades' own matching (the entries are regular expressions; whether they are matched from the start of the name or anywhere is why the README only says to anchor an entry that must not match longer names). - Like the other unattended-upgrades settings, the drop-in is only managed when `unattended-upgrades` is in the profile's packages (the README says so). --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Dragonish added 1 commit 2026-11-23 18:23:22 +00:00
feat(system_baseline): add a per-host package blacklist for unattended-upgrades
Build / build (pull_request) Successful in 19s
Lint / lint (pull_request) Successful in 1m21s
Molecule / molecule (pull_request) Successful in 2m8s
e4c69dfdd8
system_baseline_unattended_upgrade_package_blacklist (list of regular
expressions, default empty) is written to a drop-in as
Unattended-Upgrade::Package-Blacklist; an empty list removes it.

Assisted-by: Claude Code
Defame1297 approved these changes 2026-11-23 18:24:31 +00:00
Dismissed
Dragonish added 1 commit 2026-11-23 18:51:59 +00:00
docs(system_baseline): add a Proxmox example for the package blacklist
Build / build (pull_request) Successful in 17s
Lint / lint (pull_request) Successful in 1m23s
Molecule / molecule (pull_request) Successful in 2m6s
325c24a8d0
Packages that should only change through a deliberate apt dist-upgrade.

Assisted-by: Claude Code
Dragonish dismissed Defame1297's review 2026-11-23 18:51:59 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

Defame1297 added 1 commit 2026-11-23 19:55:49 +00:00
Merge branch 'main' into feat/322-unattended-blacklist
Build / build (pull_request) Successful in 16s
Lint / lint (pull_request) Successful in 1m13s
Molecule / molecule (pull_request) Successful in 2m12s
163bb21f40
Defame1297 merged commit 97f5328043 into main 2026-11-23 20:00:04 +00:00
Defame1297 deleted branch feat/322-unattended-blacklist 2026-11-23 20:00:07 +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#325