Repository navigation
Description
Problem or Motivation
devops infra plan shows a skip by a false when as "no change" and every other skip as unchecked (_is_check_mode_skip and _is_skipped_item in src/devops_cli/infra/plan.py). Some tasks cannot run in check mode while the change of an earlier task is still to come. For example, apt cannot find a package in a source that check mode did not add. A role skips such a task with a when that names ansible_check_mode, for example when: not (ansible_check_mode and repo is changed). The skip result has the key false_condition, so the plan shows the task neither as changed nor as unchecked.
devops infra apply then runs the playbook. The task changes in the real run, and guard 7 (unplanned_changes in src/devops_cli/infra/apply.py) finds a change that is not in the plan. The apply stops after the run changed the host. On a disruptive host, the drained node stays cordoned. An agent at level safe can also apply such a plan, because the plan shows no unchecked task. The gVisor play of the infra repository (the install of runsc from a new apt source) has this problem on its first apply and on each change of the pin.
Proposed Solution
- In
_is_check_mode_skipand_is_skipped_item, count a skip as unchecked when itsfalse_conditionnamesansible_check_mode. ansible-core puts the first false item of thewhenlist intofalse_condition(Task._resolve_conditional_with_itemin ansible-core 2.22.0). So a role can put the condition of the work first in awhenlist, and a skip with nothing to do does not name check mode. - Record a check-mode run of the pinned
ansible-runneron a new play of the probe intests/fixtures/infra/runner_events/probe/: one task skipped bywhen: not ansible_check_mode, one loop with items that the samewhenskips, and one task with awhenlist whose first false item does not name check mode. Pin the result intests/infra/test_plan.py. - Update the module docstring of
plan.pyand the infra page of the docs with the rule.
Acceptance Criteria
- In the recorded run, the task and the loop that
when: not ansible_check_modeskips are unchecked. - The task whose first false
whenitem does not nameansible_check_modeis not unchecked. - The tests of
tests/infra/pass, and the docs name the rule.
Existing Tool Considered
ansible-core already writes the false condition into each skip result. The change reads that field. It adds no tool and builds no parser.
Source: #5120
Activity
dan-petty commentedon Nov 13, 2026
Both items fix a mismatch between the plan and the apply in the infra area, but this candidate fixes the classification of check-mode skips while 5352 fixes a terminal-color difference in the fresh check.devops-cli-service commentedon Nov 13, 2026
Released in v0.130.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.130.0
devops-cli-service commentedon Nov 13, 2026
Live since 2026-11-13 18:17 UTC