Ansible pause Module: Wait for Input, Delay & Prompt Users (Complete Guide)
By Luca Berton · Published 2024-01-01 · Category: troubleshooting
Complete guide to Ansible pause module. Add delays, wait for user input, prompt for confirmation, and control playbook timing with practical examples.
How to pause a playbook execution for a certain amount of time with Ansible? I'm going to show you a live Playbook with some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot
Ansible pause execution Today we're talking about the Ansible module pause. This module is also supported for Windows targets. The full name is ansible.builtin.pause, which means that is part of the collection of modules "builtin" with Ansible and shipped with it. The default behavior is to pause with a prompt. Pauses playbook execution for a set amount of time, or until a prompt is acknowledged.
Parameters • minutes string - a positive number of minutes • seconds string - a positive number of seconds • prompt string - "Text message" • echo boolean - yes/no
All parameters are optional. The default behavior is to pause with a prompt. You could specify the amount of time using the parameters "minutes" and "seconds". Starting in Ansible 2.2, if you specify 0 or negative for minutes or seconds, it will wait for 1 second, previously it would wait indefinitely. When minutes or seconds are specified, user input is not captured or echoed, regardless of the echo setting. I'll cover the user input in another video.
## Playbook Let's jump in a real-life Ansible Playbook to pause a playbook execution.
code • pause.yml
output
output with manual continue (CTRL+C and "C")
output with manual abort (CTRL+C and "A")
Conclusion
Now you know how to pause a playbook execution for certain amount of time with Ansible.
Pause for Duration
Pause for User Input
Approval Gate
Wait for Service
Deployment Patterns
Rolling deploy with pause
Drain connections before shutdown
pause vs wait_for
| Module | Use Case | |--------|----------| | pause | Fixed delay or user input | | wait_for | Wait for port/file/condition | | wait_for_connection | Wait for SSH to be available | | uri + until | Wait for HTTP endpoint |
FAQ
Does pause work in AWX/AAP?
Time-based pauses work. Prompts for user input use AWX's approval workflow instead of terminal input.
How do I skip pauses in CI/CD?
Can I pause with a countdown?
The pause module shows elapsed time. For a visual countdown, use shell: sleep or a loop with decreasing delays.
Related Articles • Ansible Inventory Guide • Ansible for Windows Guide
Category: troubleshooting
Watch the video: Ansible pause Module: Wait for Input, Delay & Prompt Users (Complete Guide) — Video Tutorial