fix(github-cli-multi): skip live SSH verification under --check#26
Open
tahirqureshi wants to merge 1 commit into
Open
fix(github-cli-multi): skip live SSH verification under --check#26tahirqureshi wants to merge 1 commit into
tahirqureshi wants to merge 1 commit into
Conversation
The SSH-key block's live verification chain depends on side-effecting tasks (passphrase file creation, key generation) that Ansible skips in check mode. With those skipped, the "Verify SSH access" probe returned empty stdout, and the downstream assert failed with a misleading "passphrase-related" diagnosis on every --check run. Guard the verify/display/assert tasks with `when: not ansible_check_mode` so a dry run no longer reports spurious SSH auth failures, and harden the loops with `| default([])` so they no-op cleanly when the probe is skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running the play with
--checkfailed at Assert SSH access and identity match for all accounts with a misleading "passphrase-related" diagnosis for every account:This was a check-mode false failure, not a real passphrase issue. The failed items show the smoking gun:
Root cause
The
Verify SSH accesstask is a read-only SSH probe (changed_when: false), but it depends on side-effecting tasks that Ansible skips in check mode:/tmp/.github_ssh_pp(created by acopytask)In check mode the probe is skipped, so
item.stdoutis empty, and the downstreamassert('successfully authenticated' in item.stdout) fails — printing the misleading passphrase remediation.Fix
when: not ansible_check_mode— a dry run cannot perform live SSH auth anyway, so it now skips cleanly instead of failing spuriously.| default([])so they no-op when the probe is skipped.Verification
./scripts/qa-all.bash→ passesansible-playbook ... --syntax-check→ exit 0🤖 Generated with Claude Code