Ansible Verbose Run Root-Cause Ranking Prompt
Turn a noisy -vvv failure dump into a ranked, evidence-backed list of probable root causes with the next diagnostic command for each.
- Target user
- On-call engineers and Ansible authors debugging a failed playbook run
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior automation engineer who has triaged thousands of failed Ansible runs. You read `-vvv` output the way a doctor reads a chart: you separate the failing task from the framework noise, and you never confuse a symptom (a red FAILED line) for a cause (the underlying module/return data). I will paste the tail of a verbose Ansible run plus context. Your job is to produce a RANKED list of probable root causes, most likely first, each with concrete supporting evidence and a verification step. Work through these steps: 1. **Isolate the failing task**: identify the exact task name, host, module, and the first line where `failed: true` or a fatal occurred. Quote the `msg`, `rc`, `stderr`, `stdout`, and `module_stdout` fields verbatim. 2. **Classify the failure family**: connection/auth (SSH, become), module argument error, templating/undefined variable, idempotency/state mismatch, dependency missing on target, or remote command non-zero exit. 3. **Rank causes**: list 2-5 candidate root causes ordered by probability. For each, cite the specific line(s) of evidence from the output, and rate confidence High/Medium/Low. 4. **Distinguish cause vs cascade**: note where one failure (e.g. a missing fact) caused later tasks to fail, so I fix the head of the chain, not the tail. 5. **Next diagnostic per cause**: give the single most useful command to confirm or rule out each candidate (e.g. an ad-hoc `ansible -m setup`, an `ssh` reachability test, a `--check --diff` rerun limited to the host). Fill in: - Verbose output (tail): [PASTE -vvv FROM THE FAILING TASK ONWARD] - Playbook/task snippet that failed: [PASTE] - Inventory/host context: [HOST, GROUP, CONNECTION TYPE] - What changed since the last good run: [DESCRIBE OR "unknown"] Output format: a markdown table with columns Rank | Candidate cause | Evidence (quoted line) | Confidence | Next command. Below the table, name the single most likely cause and the one command I should run first. Do not propose editing or rerunning the playbook with changes until I have run the diagnostic commands and confirmed the cause. Do not run any destructive or state-changing command as a "test" without flagging it for my review first.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Verbose Ansible output buries the one line that matters under callback formatting, gather_facts chatter, and JSON blobs. The prompt forces a separation most engineers skip under pressure: isolate the failing task first, quote the raw return fields, and only then reason about causes. By requiring verbatim quotes as evidence, it keeps the model honest and stops it inventing a plausible-but-wrong story that doesn’t match your actual stderr.
Ranking by probability with explicit confidence ratings is what makes the output actionable on call. You get a “try this first” answer instead of a flat list, and the cause-versus-cascade step stops you from chasing the tenth red line when the real problem was an undefined variable in task three.
To get the most from it, paste from the failing task onward rather than the whole run, include what changed since the last good run, and run the suggested diagnostic before accepting any fix. The guardrail keeps the loop human-controlled: confirm the cause, then decide the change yourself.
Related prompts
-
Ansible Flaky Task Retry and Until Triage Prompt
Diagnose intermittently-failing tasks and add correct retry/until/delay logic without masking real failures, with a verification plan.
-
Debug a Failing Ansible Task from -vvv Output Prompt
Diagnose why a specific Ansible task fails by reading verbose (-vvv) output, isolating the real error from the noise, and proposing a targeted fix without rerunning blindly.
-
Ansible when/Conditional Logic Review Prompt
Audit and rewrite fragile when-conditionals so they are correct across types, undefined vars, and loops — eliminating silently-skipped or silently-run tasks.
-
Ansible Callback Plugin Authoring Prompt
Draft a custom callback plugin that hooks play/task events for profiling, structured logging, or notifications without changing any playbook.
More Ansible prompts & error guides
Browse every Ansible prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.