Files
Kamino/roles/system_baseline/tasks/update.yml
T
Dragonish 55bd5d5231
Build / build (pull_request) Successful in 17s
Molecule / molecule (pull_request) Successful in 1m52s
Lint / lint (pull_request) Successful in 2m8s
fix(system_baseline): do not report a pending package upgrade as drift in check mode
The main flow skips the apt upgrade in check mode; autoremove and
autoclean are a task of their own and stay checked. The update entry
point is unchanged and still previews the upgrade.

Assisted-by: Claude Code
2026-11-23 17:54:58 +00:00

20 lines
1.0 KiB
YAML

---
# In the main flow a dry run (--check) does not run the upgrade: a package that is only waiting for the next patch run is not drift, and
# the package module reports `changed` for it, so a scheduled dry run flagged every host whenever a package landed in between. The
# tasks_from: update entry point is an explicit request to update and still previews the upgrade in check mode: only main.yml sets
# __system_baseline_main_flow. Leftover packages (autoremove) and the cache (autoclean) stay checked either way.
- name: Update & upgrade apt packages
ansible.builtin.package:
update_cache: true
upgrade: true
cache_valid_time: 3600
become: true
when: not (ansible_check_mode and __system_baseline_main_flow | default(false))
# autoremove must stay in this task: the apt module accepts autoclean alone only together with one of autoremove, name, update_cache or upgrade.
- name: Remove unused packages and clean the apt cache
ansible.builtin.package:
autoremove: true
autoclean: true
become: true