refactor(roles): detect check mode only with ansible_check_mode #271

Open
opened 2026-11-20 20:55:37 +00:00 by Claude · 1 comment
Owner

Spec: Role interface and semver: output facts, handler names, dropped platforms and internal roles, resolution comment, point 9.

What

The only allowed check-mode guards are check_mode: false on read-only probes and when: not ansible_check_mode, and --check is the supported preview. On ansible-core 2.22.0 a play-level check_mode: true leaves ansible_check_mode False (checked on 2026-11-20), so the roles that use it already misbehave under that keyword; ufw alone works around it with a skipped probe task.

  • ufw: replace each probe (tasks/sysctl.yml, tasks/orphan_rules.yml, tasks/service_rules.yml: the command: "true" task and the set_fact that reads is skipped) with ansible_check_mode, and remove the comments that explain the probe. Update the README line that describes it.
  • Every role README: one line, "Preview with --check; a play-level check_mode: true is not supported (it does not set ansible_check_mode)." In a public role's README it goes in the Notes; in an internal role's README it goes in the nearest fitting section (no Notes heading is added for it).
  • A breaking_changes fragment for ufw: a play-level check_mode: true is no longer detected.

Done when

  • Molecule passes for ufw, including its check-mode scenarios.
  • No is skipped probe for check mode remains under roles/.
  • The PR says what was verified and what was not.

Not in scope

Adding the molecule check step (test(roles): run molecule's check step before and after converge). Either can land first; this one leaves that issue nothing to decide about ufw.

Spec: [Role interface and semver: output facts, handler names, dropped platforms and internal roles](https://git.rkdr.net/Mortis/Kamino/issues/257), resolution comment, point 9. ## What The only allowed check-mode guards are `check_mode: false` on read-only probes and `when: not ansible_check_mode`, and `--check` is the supported preview. On ansible-core 2.22.0 a play-level `check_mode: true` leaves `ansible_check_mode` False (checked on 2026-11-20), so the roles that use it already misbehave under that keyword; `ufw` alone works around it with a skipped probe task. - `ufw`: replace each probe (`tasks/sysctl.yml`, `tasks/orphan_rules.yml`, `tasks/service_rules.yml`: the `command: "true"` task and the `set_fact` that reads `is skipped`) with `ansible_check_mode`, and remove the comments that explain the probe. Update the README line that describes it. - Every role README: one line, "Preview with `--check`; a play-level `check_mode: true` is not supported (it does not set `ansible_check_mode`)." In a public role's README it goes in the Notes; in an internal role's README it goes in the nearest fitting section (no Notes heading is added for it). - A `breaking_changes` fragment for `ufw`: a play-level `check_mode: true` is no longer detected. ## Done when - Molecule passes for `ufw`, including its check-mode scenarios. - No `is skipped` probe for check mode remains under `roles/`. - The PR says what was verified and what was not. ## Not in scope Adding the molecule `check` step ([test(roles): run molecule's check step before and after converge](https://git.rkdr.net/Mortis/Kamino/issues/134)). Either can land first; this one leaves that issue nothing to decide about `ufw`.
Claude added this to the Continuous delivery milestone 2026-11-20 20:55:37 +00:00
Claude added the
Status
Ready for Agent
label 2026-11-20 20:55:37 +00:00
Author
Owner

Body edited on 2026-11-20 (final validation round of the map, #87 (comment)): decision 7: the check-mode line goes in the Notes of each public role's README and in the nearest fitting section of an internal role's README (no Notes heading is added for it).

Body edited on 2026-11-20 (final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281): decision 7: the check-mode line goes in the Notes of each public role's README and in the nearest fitting section of an internal role's README (no Notes heading is added for it).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#271