Debian Codegraph @

lib/ansible/modules/pause.py

raw
1 # -*- coding: utf-8 -*-
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 from __future__ import annotations
5
6
7 DOCUMENTATION = """
8 ---
9 module: pause
10 short_description: Pause playbook execution
11 description:
12 - Pauses playbook execution for a set amount of time, or until a prompt is acknowledged.
13 All parameters are optional. The default behavior is to pause with a prompt.
14 - To pause/wait/sleep per host, use the M(ansible.builtin.wait_for) module.
15 - 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.
16 To continue early press C(ctrl+c) and then C(c). To abort a playbook press C(ctrl+c) and then C(a).
17 - Prompting for a set amount of time is not supported. Pausing playbook execution is interruptible but does not return user input.
18 - The pause module integrates into async/parallelized playbooks without any special considerations (see Rolling Updates).
19 When using pauses with the C(serial) playbook parameter (as in rolling updates) you are only prompted once for the current group of hosts.
20 - This module is also supported for Windows targets.
21 version_added: "0.8"
22 options:
23 minutes:
24 description:
25 - A positive number of minutes to pause for.
26 seconds:
27 description:
28 - A positive number of seconds to pause for.
29 prompt:
30 description:
31 - Optional text to use for the prompt message.
32 - User input is only returned if O(seconds) and O(minutes) are both not specified,
33 otherwise this is just a custom message before playbook execution is paused.
34 echo:
35 description:
36 - Controls whether or not keyboard input is shown when typing.
37 - Only has effect if neither O(seconds) nor O(minutes) are set.
38 type: bool
39 default: 'yes'
40 version_added: 2.5
41 author: "Tim Bielawa (@tbielawa)"
42 extends_documentation_fragment:
43 - action_common_attributes
44 - action_common_attributes.conn
45 - action_common_attributes.flow
46 attributes:
47 action:
48 support: full
49 async:
50 support: none
51 become:
52 support: none
53 bypass_host_loop:
54 support: full
55 check_mode:
56 support: full
57 connection:
58 support: none
59 delegation:
60 support: none
61 diff_mode:
62 support: none
63 platform:
64 platforms: all
65 notes:
66 - 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.
67 - User input is not captured or echoed, regardless of echo setting, when minutes or seconds is specified.
68 """
69
70 EXAMPLES = """
71 - name: Pause for 5 minutes to build app cache
72 ansible.builtin.pause:
73 minutes: 5
74
75 - name: Pause until you can verify updates to an application were successful
76 ansible.builtin.pause:
77
78 - name: A helpful reminder of what to look out for post-update
79 ansible.builtin.pause:
80 prompt: "Make sure org.foo.FooOverload exception is not present"
81
82 - name: Pause to get some sensitive input
83 ansible.builtin.pause:
84 prompt: "Enter a secret"
85 echo: no
86 """
87
88 RETURN = """
89 user_input:
90 description: User input from interactive console
91 returned: if no waiting time set
92 type: str
93 sample: Example user input
94 start:
95 description: Time when started pausing
96 returned: always
97 type: str
98 sample: "2017-02-23 14:35:07.298862"
99 stop:
100 description: Time when ended pausing
101 returned: always
102 type: str
103 sample: "2017-02-23 14:35:09.552594"
104 delta:
105 description: Time paused in seconds
106 returned: always
107 type: str
108 sample: 2
109 stdout:
110 description: Output of pause module
111 returned: always
112 type: str
113 sample: Paused for 0.04 minutes
114 echo:
115 description: Value of echo setting
116 returned: always
117 type: bool
118 sample: true
119 """