pause¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version0.8.
Synopsis¶
- Pauses playbook execution for a set amount of time, or until a prompt is acknowledged. All parameters are optional. The default behavior is to pause with a prompt.
- To pause/wait/sleep per host, use the M(ansible.builtin.wait_for) module.
- You can use C(ctrl+c) if you wish to advance a pause earlier than it is set to expire or if you need to abort a playbook run entirely. To continue early press C(ctrl+c) and then C(c). To abort a playbook press C(ctrl+c) and then C(a).
- Prompting for a set amount of time is not supported. Pausing playbook execution is interruptible but does not return user input.
- The pause module integrates into async/parallelized playbooks without any special considerations (see Rolling Updates). When using pauses with the C(serial) playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.
- This module is also supported for Windows targets.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| echo bool |
Default: yes |
Controls whether or not keyboard input is shown when typing. Only has effect if neither O(seconds) nor O(minutes) are set. Version Added: 2.5 |
| minutes | A positive number of minutes to pause for. | |
| prompt | Optional text to use for the prompt message. User input is only returned if O(seconds) and O(minutes) are both not specified, otherwise this is just a custom message before playbook execution is paused. |
|
| seconds | A positive number of seconds to pause for. |
Notes¶
Note
- Starting in 2.2, if you specify 0 or negative for minutes or seconds, it will wait for 1 second, previously it would wait indefinitely.
- User input is not captured or echoed, regardless of echo setting, when minutes or seconds is specified.
Examples¶
- name: Pause for 5 minutes to build app cache
ansible.builtin.pause:
minutes: 5
- name: Pause until you can verify updates to an application were successful
ansible.builtin.pause:
- name: A helpful reminder of what to look out for post-update
ansible.builtin.pause:
prompt: "Make sure org.foo.FooOverload exception is not present"
- name: Pause to get some sensitive input
ansible.builtin.pause:
prompt: "Enter a secret"
echo: no
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| delta | str | Time paused in seconds | always |
| echo | bool | Value of echo setting | always |
| start | str | Time when started pausing | always |
| stdout | str | Output of pause module | always |
| stop | str | Time when ended pausing | always |
| user_input | str | User input from interactive console | if no waiting time set |
Authors¶
- Tim Bielawa (@tbielawa)