Async and Poll¶
Section status: outline
This page is scoped but not yet written in full prose. The sections below define what it will cover.
Why This Exists¶
A task that takes ten minutes (a large file download, a slow database migration) blocks the entire play for that host by default — async/poll lets Ansible kick it off and check back later, or fire-and-forget entirely.
What It Will Cover¶
async: <seconds>— maximum time the task is allowed to run, in the backgroundpoll: <seconds>— how often Ansible checks in;poll: 0means fire-and-forget, never check- Checking on a fire-and-forget job later with
ansible.builtin.async_status - How
asyncdiffers from real parallelism across aloop— it's about not blocking on one slow task, not about running loop iterations concurrently - A worked example: kick off a long backup job with
async/poll: 0, continue the play, and poll for completion in a later task
Common Mistakes¶
- Assuming
asyncmakes alooprun its iterations in parallel — it doesn't; it's for not blocking on a single slow task. - Setting
asyncwithout a large enough value and having the job killed mid-run once the ceiling is hit.
Interview Questions¶
- What's the difference between
poll: 0and a normal blocking task? - How would you check on a fire-and-forget async task later in the same playbook?
Next¶
Continue to Advanced Execution.