Ansible Strategy Plugin Selection & Tuning Prompt
Choose and tune the right execution strategy (linear, free, host_pinned) with forks and serial for a play, trading throughput against blast radius and ordering guarantees.
- Target user
- Engineers running plays across large fleets who need faster runs without losing rolling-update safety
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior Ansible engineer who picks the execution strategy on purpose, because strategy plus `forks` and `serial` together decide both how fast a play runs and how much of the fleet is in-flight at once — throughput versus blast radius. I will describe a play and its fleet. Recommend and tune the strategy. Steps: 1. **Strategy choice**: pick `linear` (per-task barrier, predictable order), `free` (hosts race independently, maximum throughput), or `host_pinned`, and justify it against the play's ordering needs. 2. **Ordering safety**: if the play is a rolling update that needs lockstep, keep `linear` + `serial` and explain why `free` is unsafe there. 3. **forks**: recommend a `forks` value sized to the controller's CPU/memory and the targets' connection limits, not an arbitrary large number. 4. **serial**: set `serial` (count or percentage, possibly ramped) to cap blast radius independent of strategy. 5. **Pipelining and connection tuning**: note `pipelining`, `ControlPersist`, and fact-gathering cost as multipliers on real-world speed. 6. **Measure**: use the `profile_tasks` callback and a controlled run to confirm the change actually helped before adopting it fleet-wide. Fill in: - Play type: [rolling update / independent config / one-off batch] - Fleet size: [N hosts] - Ordering requirement: [strict lockstep / none] - Controller resources: [CPU/RAM] Output format: the strategy + forks + serial recommendation with rationale, the ansible.cfg/play settings, the ordering-safety caveat, and a profile_tasks measurement plan.
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
Ansible’s default linear strategy is safe but leaves throughput on the table, and teams reach for free or crank forks without understanding what they’re trading. This prompt treats strategy, forks, and serial as one coupled decision — how fast the play runs versus how many hosts are in-flight at once — and forces a justification against the play’s actual ordering needs rather than a guess.
The two guardrails capture the failure modes people hit. free removes the per-task barrier so hosts race ahead, which is exactly wrong for a rolling update that depends on lockstep ordering and can take down more of the fleet than intended. And forks set past the controller’s or targets’ capacity doesn’t fail cleanly — it degrades into flaky connection and resource errors. By ending on a profile_tasks measurement step, the prompt insists the tuning is proven to help before it goes fleet-wide.
Related prompts
-
Ansible Performance Tuning: Forks, Pipelining and Strategy Prompt
Diagnose slow Ansible runs and tune forks, pipelining, fact gathering, and strategy to cut wall-clock time without exhausting the control node or breaking become.
-
Ansible async and poll Orchestration Design Prompt
Design fire-and-forget and long-running Ansible tasks with async, poll, and async_status so jobs don't time out and results are collected reliably.
-
Ansible Cacheable set_fact Design Prompt
Design cacheable set_fact and registered facts with clean namespacing so reruns are fast and deterministic instead of recomputing everything every play.
-
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.