AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Ansible pause Module: Wait for Input or Delay Playbook Execution — Video Tutorial
How to pause Ansible playbook execution with the pause module (ansible.builtin.pause). Wait for user input, add delays between tasks, set timeout.
What You'll Learn
- How to pause a playbook execution for a certain amount of time with Ansible?
- Ansible pause execution
- Parameters
- code
- output
- Conclusion
- Pause for Duration
- Pause for User Input
- Approval Gate
- Wait for Service
Full Tutorial Content
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
```yaml
---
- name: pause module Playbook
hosts: all
vars:
wait_seconds: 10
tasks:
- name: pause for {{ wait_seconds | int }} second(s)
ansible.builtin.pause:
seconds: "{{ wait_seconds | int }}"
- name: message
ansible.builtin.debug:
msg: "The end"
```
output
```bash
$ ansible-playbook -i Playbook/inventory pause/pause.yml
PLAY [pause module Playbook] **************************************************************************
TASK [Gathering Facts] ****************************************************************************
ok: [demo.example.com]
TASK [pause for 10 second(s)] *********************************************************************
Pausing for 10 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [demo.example.com]
TASK [message] ************************************************************************************
ok: [demo.example.com] => {
"msg": "The end"
}
PLAY RECAP ****************************************************************************************
demo.example.com : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```
output with manual continue (CTRL+C and "C")
```bash
$ ansible-playbook -i Playbook/inventory pause/pause.yml
PLAY [pause module Playbook] **************************************************************************
TASK [Gathering Facts] ****************************************************************************
ok: [demo.example.com]
TASK [pause for 10 second(s)] *********************************************************************
Pausing for 10 seconds
(ctrl+
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 5 min
- Category: troubleshooting
Read the full written article: Ansible pause Module: Wait for Input or Delay Playbook Execution