feat(system_baseline): add an update toggle and pin the pve unattended-upgrades origins
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 35s
Molecule / molecule (pull_request) Successful in 1m46s

system_baseline_update (default true) lets the main flow skip the package
update for hosts patched by a separate, operator-run flow. The update entry
point does not read it: calling it is the request to update.

The new profile key unattended_upgrade_origins is rendered into
/etc/apt/apt.conf.d/90unattended-upgrades-origins, which #clears both
origin lists before setting the pinned patterns, because apt appends list
entries across files and a plain drop-in could only widen them. The pve
profile pins Debian's point-release and security origins, never the
Proxmox repository; the ubuntu profiles pin nothing and are unchanged.

Refs defame1297/ansible-homelab-mono#349

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-14 22:11:36 +00:00
1 parent 8a3c7d0fc2
commit 52d06204bb
10 files changed
+181 -7

No files matched your search

+2
View File
@@ -3,8 +3,10 @@
ansible.builtin.import_tasks: validate.yml
tags: always
# Only the main flow honours system_baseline_update: the tasks_from: update entry point is an explicit request to update.
- name: Update & Upgrade Dist
ansible.builtin.import_tasks: update.yml
when: system_baseline_update | bool
tags: update
- name: Manage packages
@@ -21,6 +21,25 @@
mode: "0644"
loop: "{{ system_baseline_unattended_upgrade_settings | dict2items }}"
# apt appends list entries across apt.conf.d files, so a later file cannot narrow the origins of 50unattended-upgrades by
# listing its own: the drop-in clears both origin lists first (#clear) and then sets the pinned ones. It sorts after 50.
- name: Pin the unattended-upgrades origins
become: true
ansible.builtin.template:
src: unattended-upgrades-origins.j2
dest: /etc/apt/apt.conf.d/90unattended-upgrades-origins
owner: root
group: root
mode: "0644"
when: system_baseline_unattended_upgrade_origins | length > 0
- name: Remove the origins pin when none is set
become: true
ansible.builtin.file:
path: /etc/apt/apt.conf.d/90unattended-upgrades-origins
state: absent
when: system_baseline_unattended_upgrade_origins | length == 0
- name: Validate unattended-upgrades config
become: true
ansible.builtin.command: unattended-upgrades --dry-run --debug
+14
View File
@@ -34,3 +34,17 @@
quiet: true
when: system_baseline_tmux_autostart | bool
tags: always
# Each origin is written inside a double-quoted apt.conf string: a quote or a line break would end it, a backslash could escape.
- name: Validate the unattended-upgrades origins
ansible.builtin.assert:
that:
- system_baseline_unattended_upgrade_origins is sequence
- system_baseline_unattended_upgrade_origins is not string
- system_baseline_unattended_upgrade_origins | select('string') | select('match', '^[^"\\\\\n\r]+\Z') | list | length
== system_baseline_unattended_upgrade_origins | length
fail_msg: >-
system_baseline_unattended_upgrade_origins must be a list of non-empty one-line strings without a double quote
or a backslash.
quiet: true
tags: always