BacklogZero®

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.

YAML
---
# Prompt: loop server1 and server2 with debug and pause 3 seconds between items
- name: Loop through servers and print names
  hosts: all
  gather_facts: false
  tasks:
    - name: Loop through servers
      ansible.builtin.debug:
        msg: "{{ item }}"
      loop:
        - server1
        - server2
      loop_control:
        pause: 3

How it works

loop_control.pause is a delay in seconds between items. This task prints server1, waits 3 seconds, then prints 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-02

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

Built for every Ansible use case in every organization

BacklogZero can generate this kind of automation in your environment, just like it did here.

Get BacklogZero today →

Related guides

← Back to Ansible in a Minute

Use loop_control pause between loop items · Level Up Labs