Merge branch 'main' into feat/319-docker-prune-count-threshold
This commit is contained in:
commit
35f7e772a5
5 files changed
+31
-4
No files matched your search
@@ -0,0 +1,8 @@
|
||||
---
|
||||
bugfixes:
|
||||
- >-
|
||||
system_baseline - Do not run the apt upgrade in check mode in the main flow. A package that is only waiting for the next patch run, or a
|
||||
package cache older than an hour, is not drift, but the package module reports both as changed, so a scheduled dry run flagged every
|
||||
host. Autoremove and autoclean are now a task of their own and stay checked; as part of the upgrade call the module did not reach
|
||||
autoclean, so ``apt-get autoclean`` now runs (and may report changed once on a host with stale archives), in the main flow and in the
|
||||
``update`` entry point. The ``update`` entry point still previews the upgrade in check mode.
|
||||
@@ -58,7 +58,7 @@ system_baseline_profile_overrides:
|
||||
|
||||
Besides `main`, two task files are a supported interface, for a caller that drives its own reboot (for example a Kubernetes node patch flow that cordons and drains first). Their names, the fact name and the behaviour below follow the Collection's semantic versioning: changing them is a breaking change.
|
||||
|
||||
- `tasks_from: update`: apt update, upgrade, autoremove and autoclean, nothing else. It does not read `system_baseline_update`: calling the entry point is the request to update.
|
||||
- `tasks_from: update`: apt update, upgrade, autoremove and autoclean, nothing else. It does not read `system_baseline_update`: calling the entry point is the request to update. In check mode it previews the upgrade; the main flow does not (see "Check mode").
|
||||
- `tasks_from: reboot`: sets the fact `system_baseline_reboot_required` (bool, from `/var/run/reboot-required`) on Debian family hosts, then reboots when `system_baseline_reboot_if_required` is true and the fact is true. With `system_baseline_reboot_if_required: false` it only computes the fact. On other families the fact is not set, so read it with `default(false)`.
|
||||
|
||||
```yaml
|
||||
@@ -119,6 +119,10 @@ system_baseline_tmux_windows:
|
||||
|
||||
`system_baseline_update: false` skips the package update of the main flow, for hosts patched by a separate, operator-run flow (for example a full upgrade with a rolling reboot). Everything else, unattended-upgrades included, still runs. The reboot check still runs as well, so set `system_baseline_reboot_if_required: false` too when that flow owns the reboot. Running the play with `--skip-tags update` skips the same task for one run only, and also the reboot.
|
||||
|
||||
## Check mode
|
||||
|
||||
In a dry run (`--check`) the main flow does not run the apt upgrade: a package that is only waiting for the next patch run, or a package cache older than an hour, is not drift, and the package module reports both as `changed`, so a scheduled dry run would flag every host whenever a package landed in between. The autoremove and autoclean step still runs, and is checked: a leftover package it would remove is reported as `changed`, on purpose. `apt-get autoclean` runs in this step in a real run, in the main flow and in the `update` entry point. The `update` entry point is unchanged: it is an explicit request to update, so in check mode it still previews the upgrade.
|
||||
|
||||
## Unattended-upgrades origins
|
||||
|
||||
A profile's `unattended_upgrade_origins` list pins the origins unattended-upgrades may install from. apt merges every file in `/etc/apt/apt.conf.d` and appends list entries across files, so a later file that only lists origins would widen the distribution's `50unattended-upgrades`, never narrow it. A non-empty list is therefore written to `/etc/apt/apt.conf.d/90unattended-upgrades-origins`, which sorts after `50unattended-upgrades`, clears `Unattended-Upgrade::Allowed-Origins` and `Unattended-Upgrade::Origins-Pattern` (apt's `#clear` directive) and sets only the listed patterns. The origin lists in `50unattended-upgrades` itself are not edited. An empty or missing list removes the drop-in.
|
||||
|
||||
@@ -111,11 +111,14 @@ argument_specs:
|
||||
separate flow; the reboot check still runs, so set C(system_baseline_reboot_if_required) as well when that flow also owns
|
||||
the reboot.
|
||||
- The C(update) entry point does not read it.
|
||||
- In check mode the main flow skips the upgrade itself (a pending update is not drift); autoremove and autoclean are still checked.
|
||||
update:
|
||||
short_description: Update and upgrade apt packages
|
||||
description:
|
||||
- Runs an apt update, upgrade, autoremove and autoclean, and nothing else.
|
||||
- Calling it is a request to update, so it does not read C(system_baseline_update), which only gates the main flow.
|
||||
- >-
|
||||
Calling it is a request to update, so it does not read C(system_baseline_update), which only gates the main flow. In check mode it
|
||||
still previews the upgrade.
|
||||
- >-
|
||||
A supported entry point (C(tasks_from=update)) for a caller that drives its own reboot, for example a
|
||||
Kubernetes node patch flow that drains the node first.
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
# 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
|
||||
vars:
|
||||
__system_baseline_main_flow: true
|
||||
when: system_baseline_update | bool
|
||||
tags: update
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
---
|
||||
# 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
|
||||
autoremove: true
|
||||
autoclean: 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
|
||||
Reference in new issue
Block a user