tasks/update.yml runs ansible.builtin.package with upgrade: true, autoremove: true and autoclean: true in one task, in check mode as well. In check mode the package manager reports changed as soon as any package is waiting for an upgrade, so a scheduled dry run (ansible-playbook --check) of a play that includes this role reports every host as changed whenever a package landed between two patch runs. The play then looks like configuration drift, but nothing in the role's own configuration differs. A consumer who alerts on changed from a weekly dry run gets a false alarm on most weeks.
Out of scope: the real run, and the system_baseline_update switch that skips the whole update flow.
Proposal
Do not run the upgrade in check mode (when: not ansible_check_mode on the upgrade). A pending update is not drift.
Keep autoremove and autoclean checked, in a separate task, so a dry run still shows leftover packages.
Say it in the README (Notes) and in a bugfixes or minor_changes fragment, whichever you prefer for a change in check-mode behaviour.
Acceptance criteria
In check mode the upgrade task is skipped and the play reports no change from it (a Molecule converge in check mode, or a --check run in side_effect.yml, with a pending upgrade available from the stub repository if the scenario has one; otherwise an assert that the task is skipped).
In a real run the upgrade still happens (the existing scenario's update tag, or a unit-level assert on the task conditions).
autoremove and autoclean still run, and are checked, in check mode.
ansible-test sanity, ansible-lint and yamllint are clean; README and changelog fragment updated.
Not verified
I have not run Kamino's role in check mode against a host with a pending upgrade. The behaviour above is what I see with the same module call in my own role: every host reported changed in a weekly dry run whenever a package was waiting.
Whether you want a dry run to show pending updates. If so, an opt-in variable instead of a skip would serve both.
The Molecule scenario skips the update tag (no privileged container), so the new behaviour may only be checkable by reading the task conditions.
Questions for the maintainer
Skip the upgrade in check mode, or make it a variable (default skip)?
Is a split into an upgrade task and an autoremove/autoclean task acceptable?
Assisted-by: Claude Code
## Problem
`tasks/update.yml` runs `ansible.builtin.package` with `upgrade: true`, `autoremove: true` and `autoclean: true` in one task, in check mode as well. In check mode the package manager reports `changed` as soon as any package is waiting for an upgrade, so a scheduled dry run (`ansible-playbook --check`) of a play that includes this role reports every host as changed whenever a package landed between two patch runs. The play then looks like configuration drift, but nothing in the role's own configuration differs. A consumer who alerts on `changed` from a weekly dry run gets a false alarm on most weeks.
Out of scope: the real run, and the `system_baseline_update` switch that skips the whole update flow.
## Proposal
- Do not run the upgrade in check mode (`when: not ansible_check_mode` on the upgrade). A pending update is not drift.
- Keep `autoremove` and `autoclean` checked, in a separate task, so a dry run still shows leftover packages.
- Say it in the README (Notes) and in a `bugfixes` or `minor_changes` fragment, whichever you prefer for a change in check-mode behaviour.
## Acceptance criteria
- [ ] In check mode the upgrade task is skipped and the play reports no change from it (a Molecule converge in check mode, or a `--check` run in `side_effect.yml`, with a pending upgrade available from the stub repository if the scenario has one; otherwise an assert that the task is skipped).
- [ ] In a real run the upgrade still happens (the existing scenario's `update` tag, or a unit-level assert on the task conditions).
- [ ] `autoremove` and `autoclean` still run, and are checked, in check mode.
- [ ] `ansible-test sanity`, ansible-lint and yamllint are clean; README and changelog fragment updated.
## Not verified
- I have not run Kamino's role in check mode against a host with a pending upgrade. The behaviour above is what I see with the same module call in my own role: every host reported `changed` in a weekly dry run whenever a package was waiting.
- Whether you want a dry run to show pending updates. If so, an opt-in variable instead of a skip would serve both.
- The Molecule scenario skips the `update` tag (no privileged container), so the new behaviour may only be checkable by reading the task conditions.
## Questions for the maintainer
- Skip the upgrade in check mode, or make it a variable (default skip)?
- Is a split into an `upgrade` task and an `autoremove`/`autoclean` task acceptable?
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
tasks/update.ymlrunsansible.builtin.packagewithupgrade: true,autoremove: trueandautoclean: truein one task, in check mode as well. In check mode the package manager reportschangedas soon as any package is waiting for an upgrade, so a scheduled dry run (ansible-playbook --check) of a play that includes this role reports every host as changed whenever a package landed between two patch runs. The play then looks like configuration drift, but nothing in the role's own configuration differs. A consumer who alerts onchangedfrom a weekly dry run gets a false alarm on most weeks.Out of scope: the real run, and the
system_baseline_updateswitch that skips the whole update flow.Proposal
when: not ansible_check_modeon the upgrade). A pending update is not drift.autoremoveandautocleanchecked, in a separate task, so a dry run still shows leftover packages.bugfixesorminor_changesfragment, whichever you prefer for a change in check-mode behaviour.Acceptance criteria
--checkrun inside_effect.yml, with a pending upgrade available from the stub repository if the scenario has one; otherwise an assert that the task is skipped).updatetag, or a unit-level assert on the task conditions).autoremoveandautocleanstill run, and are checked, in check mode.ansible-test sanity, ansible-lint and yamllint are clean; README and changelog fragment updated.Not verified
changedin a weekly dry run whenever a package was waiting.updatetag (no privileged container), so the new behaviour may only be checkable by reading the task conditions.Questions for the maintainer
upgradetask and anautoremove/autocleantask acceptable?Assisted-by: Claude Code