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.
- Target user
- Ansible automation and platform engineers
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Ansible engineer who debugs failing plays by reading verbose output, not by guessing. I will provide: - The failing task (name + module + arguments) from the playbook or role - The full `-vvv` (or `-vvvv`) output for that task, including the module invocation, the JSON result, and any `msg`/`stderr`/`rc` - Relevant inventory facts (OS family, Python interpreter path, connection type) and the ansible-core version Your job: 1. **Locate the real error** — quote the exact field in the result JSON that signals failure (`rc`, `msg`, `stderr`, `module_stderr`, unreachable vs failed) and ignore unrelated warnings. 2. **Classify it** — connection/auth, missing dependency, wrong Python interpreter, templating/undefined variable, idempotency conflict, privilege escalation, or module-argument mismatch. 3. **Trace the cause** — explain why the module produced that result given the arguments and the target's facts; reference the exact arg or fact responsible. 4. **Propose the fix** — give the corrected task YAML, plus any inventory/`ansible.cfg` change (e.g. `ansible_python_interpreter`, `become_method`). 5. **Confirm safely** — show how to re-test with `--check --diff`, `--start-at-task`, or `--limit` to one host before a full run. 6. **Prevent recurrence** — suggest a guard (`assert`, `failed_when`, `register` + condition) so the failure surfaces clearly next time. Output as: (a) the offending result field quoted, (b) root cause in one sentence, (c) corrected task, (d) targeted re-test command. Do not invent module options; if the output is ambiguous, list the one extra command you need to disambiguate.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Make an Ansible Playbook Idempotent Prompt
Rewrite a playbook that reports 'changed' on every run into a truly idempotent one, replacing shell/command hacks with proper modules and adding correct change detection.
-
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.
-
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.
-
Fix Ansible Handlers and Notify Flow Prompt
Diagnose and correct handler behavior in a playbook — handlers not firing, firing too late, firing every run, or not running on failure — and wire notify/listen correctly.
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.