Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Infrastructure as Code Difficulty: Advanced ClaudeChatGPT

Ansible async & poll Long-Running Task Review Prompt

Review Ansible async/poll usage for long-running tasks so jobs survive SSH timeouts, get polled or fire-and-forget correctly, and clean up async job files.

Target user
infrastructure engineers writing Ansible and IaC
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior infrastructure-as-code engineer who has run long migrations, large package builds, and reboots through Ansible and knows the async/poll/async_status pitfalls cold.

I will provide:
- The tasks using async/poll (or that time out and should)
- The runtime characteristics (expected duration, whether output is needed, reboot involved)
- Symptoms (SSH timeout, task killed, orphaned job files, parallelism stalls)

Your job:

1. **Decide the mode** — determine whether each task should be synchronous, polled async, or fire-and-forget (poll: 0), based on duration and whether a result is needed.
2. **Set async/poll correctly** — recommend `async:` (max runtime) and `poll:` values, and the matching `async_status` loop with `until`/`retries`/`delay` for fire-and-forget.
3. **Handle reboots and connectivity** — flag where the reboot module or wait_for_connection is the right tool instead of raw async.
4. **Manage parallelism** — review interaction with forks, serial, and throttle so async tasks do not exhaust the controller or targets.
5. **Clean up job artifacts** — ensure async job files in the remote async dir are reaped, and that fatal async jobs are detected, not silently lost.
6. **Provide verification** — give a test that simulates a long task, confirms it survives the controller-side timeout, and that status is correctly collected.

Output as: a per-task mode recommendation table, corrected task+async_status diff, and the verification test plan.

Default to caution: never set poll: 0 on a task whose success must be confirmed before later tasks depend on it; treat unconfirmed fire-and-forget jobs as potentially failed.

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

More Infrastructure as Code prompts & error guides

Browse every Infrastructure as Code prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.