Ansible in a Minute · Ansible Core ·
Use loop_control pause between loop items
Short answer
Set loop_control pause so Ansible waits a number of seconds after each loop item before it starts the next one.
Subscribe for updates
Get an email whenever we publish new guides and blog posts. Unsubscribe anytime.
By subscribing you agree we may email you about Ansible in a Minute and related Level Up Labs updates. We store your address in the same lead sheet as our contact form.
Request
loop server1 and server2 with debug and pause 3 seconds between items
Example
A quick heads-up: Every environment is different. Review and test this example before you run it on systems you care about.
---
# Prompt: loop server1 and server2 with debug and pause 3 seconds between items
- name: Loop through server1 and server2 with debug and pause 3 seconds between items
hosts: all
gather_facts: true
tasks:
- name: Debug each server
ansible.builtin.debug:
msg: "Processing {{ item }}"
loop: [server1, server2]
loop_control:
pause: 3How it works
loop_control.pause is a delay in seconds between items. This task prints Processing server1, waits 3 seconds, then prints Processing server2. The delay is not the ansible.builtin.pause module.
When to use it
- Slowing API or provision calls so a service is not flooded
- Spacing restarts or rollouts inside one looped task
Requirements
- Ansible: >=2.14
Validation
- Syntax validated
- Not execution-tested
- Last verified 2026-10-22
Notes
pause under loop_control waits after each item in that task. It does not pause between hosts. Use the pause module when you must wait once, not once per item.
Reference
- Pausing within a loop (Ansible docs)
Built for every Ansible use case in every organization
BacklogZero can generate this kind of automation in your environment, just like it did here.