On a Proxmox VE node, system_baseline runs apt-get dist-upgrade (profile pve, apt_upgrade: dist). If a scheduled backup (a vzdump task) is running on the node at that moment, the upgrade can restart Proxmox services, or later force a reboot, while the backup holds a snapshot of a guest. The consumer's play has no way to say "not now"; the only controls today are system_baseline_update: false (skips every update for every run) and timing the play outside the backup window by hand.
Out of scope: pausing guests, waiting for the backup to finish (the proposal skips and says so), non-Proxmox hosts, the reboot step, and the update entry point's default behaviour.
Proposal
One new optional bool, default false, so nothing changes unless a consumer opts in:
system_baseline_skip_upgrade_during_vzdump (bool, default false): when true and system_baseline_system_type is pve, the role asks the node for its recent tasks before the upgrade and skips the upgrade task (a visible debug message says why) if a vzdump task has no end time. It then continues with the rest of the flow.
Sketch for tasks/update.yml, before the upgrade task (all guarded on the input and on the system type being defined and pve, so off Proxmox and with the default it is a no-op):
- name:List recent Proxmox tasks on this nodeansible.builtin.command:argv:[pvesh, get, "/nodes/{{ __system_baseline_pve_node }}/tasks", "--limit", "50", "--output-format", json]register:__system_baseline_pve_taskschanged_when:falsecheck_mode:false# a command that only reads state, so a dry run sees the real statebecome:truewhen:<input is true and system type is pve>- name:Note whether a vzdump task is runningansible.builtin.set_fact:__system_baseline_vzdump_running:"{{ (__system_baseline_pve_tasks.stdout | from_json | selectattr('type', 'equalto', 'vzdump') | rejectattr('endtime', 'defined') | list | length) > 0 }}"
and the upgrade task gains and not __system_baseline_vzdump_running | default(false) in its when. The autoremove task stays as it is (the existing design keeps it separate). Node name: a new internal fact from the host's short name; an input to override it is not proposed unless the maintainer wants one.
Open question for the maintainer: update.yml is shared by the main flow and the update entry point. The default false keeps the entry point unchanged for every existing caller. Should a caller that sets the input to true and calls tasks_from: update get the guard too (one code path, proposed), or only the main flow (checked through __system_baseline_main_flow, as the check-mode skip is today)?
Also open: whether the guard belongs in the profile (a pve profile key, like apt_upgrade) rather than a flat input. A flat input is proposed because the entry point reads no profile.
Acceptance criteria
system_baseline_skip_upgrade_during_vzdump is in defaults/main.yml (false) and meta/argument_specs.yml (type: bool, description, default: false). Check: ansible-lint, ansible-doc -t role mortis.kamino.system_baseline.
With the default, a molecule run on ubuntu_lxc and ubuntu_vm executes no pvesh command and the task list is otherwise as in v3.0.0. Check: existing molecule default scenario unchanged and green.
With the input true on a non-pve system type, no pvesh call is made and the upgrade runs. Check: molecule scenario on ubuntu_lxc asserting the upgrade ran and pvesh is absent.
With the input true on pve and a running vzdump task, the upgrade is skipped, a message names the reason, and the rest of the flow runs. Check: a unit-style molecule scenario that stubs pvesh with a script printing one task with no endtime, asserts the skip message and that no apt upgrade ran.
With the input true on pve and no running task (all listed tasks have an endtime), the upgrade runs. Check: same stub printing finished tasks only.
The task that reads the task list has check_mode: false and changed_when: false. Check: review; --check on the stub scenario reports no change from it.
README (variables table, update entry-point note) and a minor_changes fragment exist. Check: pre-commit run --all-files.
Not verifiable in CI today: the real pvesh output on a Proxmox node. Check: the author runs the role once on a real node during a backup and states the result in the pull request under "Verified".
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
On a Proxmox VE node, `system_baseline` runs `apt-get dist-upgrade` (profile `pve`, `apt_upgrade: dist`). If a scheduled backup (a `vzdump` task) is running on the node at that moment, the upgrade can restart Proxmox services, or later force a reboot, while the backup holds a snapshot of a guest. The consumer's play has no way to say "not now"; the only controls today are `system_baseline_update: false` (skips every update for every run) and timing the play outside the backup window by hand.
Out of scope: pausing guests, waiting for the backup to finish (the proposal skips and says so), non-Proxmox hosts, the reboot step, and the `update` entry point's default behaviour.
## Proposal
One new optional bool, default `false`, so nothing changes unless a consumer opts in:
- `system_baseline_skip_upgrade_during_vzdump` (bool, default `false`): when `true` and `system_baseline_system_type` is `pve`, the role asks the node for its recent tasks before the upgrade and skips the upgrade task (a visible `debug` message says why) if a `vzdump` task has no end time. It then continues with the rest of the flow.
Sketch for `tasks/update.yml`, before the upgrade task (all guarded on the input and on the system type being defined and `pve`, so off Proxmox and with the default it is a no-op):
```yaml
- name: List recent Proxmox tasks on this node
ansible.builtin.command:
argv: [pvesh, get, "/nodes/{{ __system_baseline_pve_node }}/tasks", "--limit", "50", "--output-format", json]
register: __system_baseline_pve_tasks
changed_when: false
check_mode: false # a command that only reads state, so a dry run sees the real state
become: true
when: <input is true and system type is pve>
- name: Note whether a vzdump task is running
ansible.builtin.set_fact:
__system_baseline_vzdump_running: "{{ (__system_baseline_pve_tasks.stdout | from_json | selectattr('type', 'equalto', 'vzdump') | rejectattr('endtime', 'defined') | list | length) > 0 }}"
```
and the upgrade task gains `and not __system_baseline_vzdump_running | default(false)` in its `when`. The autoremove task stays as it is (the existing design keeps it separate). Node name: a new internal fact from the host's short name; an input to override it is not proposed unless the maintainer wants one.
Open question for the maintainer: update.yml is shared by the main flow and the `update` entry point. The default `false` keeps the entry point unchanged for every existing caller. Should a caller that sets the input to `true` and calls `tasks_from: update` get the guard too (one code path, proposed), or only the main flow (checked through `__system_baseline_main_flow`, as the check-mode skip is today)?
Also open: whether the guard belongs in the profile (a `pve` profile key, like `apt_upgrade`) rather than a flat input. A flat input is proposed because the entry point reads no profile.
## Acceptance criteria
- [ ] `system_baseline_skip_upgrade_during_vzdump` is in `defaults/main.yml` (`false`) and `meta/argument_specs.yml` (`type: bool`, description, `default: false`). Check: `ansible-lint`, `ansible-doc -t role mortis.kamino.system_baseline`.
- [ ] With the default, a molecule run on `ubuntu_lxc` and `ubuntu_vm` executes no `pvesh` command and the task list is otherwise as in v3.0.0. Check: existing molecule `default` scenario unchanged and green.
- [ ] With the input `true` on a non-`pve` system type, no `pvesh` call is made and the upgrade runs. Check: molecule scenario on `ubuntu_lxc` asserting the upgrade ran and `pvesh` is absent.
- [ ] With the input `true` on `pve` and a running `vzdump` task, the upgrade is skipped, a message names the reason, and the rest of the flow runs. Check: a unit-style molecule scenario that stubs `pvesh` with a script printing one task with no `endtime`, asserts the skip message and that no apt upgrade ran.
- [ ] With the input `true` on `pve` and no running task (all listed tasks have an `endtime`), the upgrade runs. Check: same stub printing finished tasks only.
- [ ] The task that reads the task list has `check_mode: false` and `changed_when: false`. Check: review; `--check` on the stub scenario reports no change from it.
- [ ] README (variables table, `update` entry-point note) and a `minor_changes` fragment exist. Check: `pre-commit run --all-files`.
- [ ] Not verifiable in CI today: the real `pvesh` output on a Proxmox node. Check: the author runs the role once on a real node during a backup and states the result in the pull request under "Verified".
This is the contributor's own code and is offered under GPL-3.0-or-later, the Collection's licence.
Assisted-by: Claude Code
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
On a Proxmox VE node,
system_baselinerunsapt-get dist-upgrade(profilepve,apt_upgrade: dist). If a scheduled backup (avzdumptask) is running on the node at that moment, the upgrade can restart Proxmox services, or later force a reboot, while the backup holds a snapshot of a guest. The consumer's play has no way to say "not now"; the only controls today aresystem_baseline_update: false(skips every update for every run) and timing the play outside the backup window by hand.Out of scope: pausing guests, waiting for the backup to finish (the proposal skips and says so), non-Proxmox hosts, the reboot step, and the
updateentry point's default behaviour.Proposal
One new optional bool, default
false, so nothing changes unless a consumer opts in:system_baseline_skip_upgrade_during_vzdump(bool, defaultfalse): whentrueandsystem_baseline_system_typeispve, the role asks the node for its recent tasks before the upgrade and skips the upgrade task (a visibledebugmessage says why) if avzdumptask has no end time. It then continues with the rest of the flow.Sketch for
tasks/update.yml, before the upgrade task (all guarded on the input and on the system type being defined andpve, so off Proxmox and with the default it is a no-op):and the upgrade task gains
and not __system_baseline_vzdump_running | default(false)in itswhen. The autoremove task stays as it is (the existing design keeps it separate). Node name: a new internal fact from the host's short name; an input to override it is not proposed unless the maintainer wants one.Open question for the maintainer: update.yml is shared by the main flow and the
updateentry point. The defaultfalsekeeps the entry point unchanged for every existing caller. Should a caller that sets the input totrueand callstasks_from: updateget the guard too (one code path, proposed), or only the main flow (checked through__system_baseline_main_flow, as the check-mode skip is today)?Also open: whether the guard belongs in the profile (a
pveprofile key, likeapt_upgrade) rather than a flat input. A flat input is proposed because the entry point reads no profile.Acceptance criteria
system_baseline_skip_upgrade_during_vzdumpis indefaults/main.yml(false) andmeta/argument_specs.yml(type: bool, description,default: false). Check:ansible-lint,ansible-doc -t role mortis.kamino.system_baseline.ubuntu_lxcandubuntu_vmexecutes nopveshcommand and the task list is otherwise as in v3.0.0. Check: existing moleculedefaultscenario unchanged and green.trueon a non-pvesystem type, nopveshcall is made and the upgrade runs. Check: molecule scenario onubuntu_lxcasserting the upgrade ran andpveshis absent.trueonpveand a runningvzdumptask, the upgrade is skipped, a message names the reason, and the rest of the flow runs. Check: a unit-style molecule scenario that stubspveshwith a script printing one task with noendtime, asserts the skip message and that no apt upgrade ran.trueonpveand no running task (all listed tasks have anendtime), the upgrade runs. Check: same stub printing finished tasks only.check_mode: falseandchanged_when: false. Check: review;--checkon the stub scenario reports no change from it.updateentry-point note) and aminor_changesfragment exist. Check:pre-commit run --all-files.pveshoutput on a Proxmox node. Check: the author runs the role once on a real node during a backup and states the result in the pull request under "Verified".This is the contributor's own code and is offered under GPL-3.0-or-later, the Collection's licence.
Assisted-by: Claude Code