/
playbook-GenericPolling.yml
228 lines (227 loc) · 4.96 KB
/
playbook-GenericPolling.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
id: GenericPolling
version: -1
name: GenericPolling
description: |-
Use as a sub-playbook to block execution of the master playbook until a remote action is complete.
This playbook implements polling by continually running the command in Step #2 until the operation completes.
The remote action should have the following structure:
1. Initiate the operation.
2. Poll to check if the operation completed.
3. (optional) Get the results of the operation.
fromversion: 4.0.0
starttaskid: "0"
tasks:
"0":
id: "0"
taskid: c644af04-2cd7-4462-83e3-5f55bc12aa73
type: start
task:
id: c644af04-2cd7-4462-83e3-5f55bc12aa73
version: -1
name: ""
description: '-'
iscommand: false
brand: ""
nexttasks:
'#none#':
- "3"
separatecontext: false
view: |-
{
"position": {
"x": 50,
"y": 50
}
}
note: false
"1":
id: "1"
taskid: c202a667-b138-4635-819f-56a7396cc7f8
type: regular
task:
id: c202a667-b138-4635-819f-56a7396cc7f8
version: -1
name: Schedule Polling Task
description: Schedule Polling Task
scriptName: ScheduleGenericPolling
type: regular
iscommand: false
brand: ""
nexttasks:
'#none#':
- "2"
scriptarguments:
dt:
simple: ${inputs.dt}
ids:
simple: ${inputs.Ids}
interval:
simple: ${inputs.Interval}
playbookId:
simple: ${currentPlaybookID}
pollingCommand:
simple: ${inputs.PollingCommandName}
pollingCommandArgName:
simple: ${inputs.PollingCommandArgName}
tag: {}
timeout:
simple: ${inputs.Timeout}
separatecontext: false
view: |-
{
"position": {
"x": 50,
"y": 370
}
}
note: false
"2":
id: "2"
taskid: 156abdbe-586e-4241-8ae6-364fe3d9d76a
type: condition
task:
id: 156abdbe-586e-4241-8ae6-364fe3d9d76a
version: -1
name: Waiting for polling to complete (Automated Task)
description: This task will complete automatically once the polling is done
tags:
- polling
type: condition
iscommand: false
brand: ""
nexttasks:
'#default#':
- "6"
"YES":
- "5"
separatecontext: false
view: |-
{
"position": {
"x": 50,
"y": 545
}
}
note: false
"3":
id: "3"
taskid: bc152ecc-4c23-4296-844a-d21b32be0ec3
type: regular
task:
id: bc152ecc-4c23-4296-844a-d21b32be0ec3
version: -1
name: RunPollingCommand
description: RunPollingCommand
scriptName: RunPollingCommand
type: regular
iscommand: false
brand: ""
nexttasks:
'#none#':
- "1"
scriptarguments:
ids:
simple: ${inputs.Ids}
pollingCommand:
simple: ${inputs.PollingCommandName}
pollingCommandArgName:
simple: ${inputs.PollingCommandArgName}
separatecontext: false
view: |-
{
"position": {
"x": 50,
"y": 195
}
}
note: false
"5":
id: "5"
taskid: 778e1007-f7ea-4ff6-89c4-cffc067165c4
type: title
task:
id: 778e1007-f7ea-4ff6-89c4-cffc067165c4
version: -1
name: Done
description: Done
type: title
iscommand: false
brand: ""
separatecontext: false
view: |-
{
"position": {
"x": -170,
"y": 740
}
}
note: false
"6":
id: "6"
taskid: 62b13486-ae6a-49c1-8988-16765f35f1cc
type: regular
task:
id: 62b13486-ae6a-49c1-8988-16765f35f1cc
version: -1
name: Scheduled Task Failed
description: Scheduled Task Failed
scriptName: PrintErrorEntry
type: regular
iscommand: false
brand: ""
scriptarguments:
message:
simple: GenericPollingScheduledTask encountered an error.
separatecontext: false
view: |-
{
"position": {
"x": 280,
"y": 725
}
}
note: false
view: |-
{
"linkLabelsPosition": {
"2_5_YES": 0.48
},
"paper": {
"dimensions": {
"height": 770,
"width": 830,
"x": -170,
"y": 50
}
}
}
inputs:
- key: Ids
value: {}
required: true
description: List of IDs to poll
- key: PollingCommandName
value: {}
required: true
description: Name of the polling command to run
- key: PollingCommandArgName
value:
simple: ids
required: true
description: Name of the argument of the polling command
- key: Interval
value:
simple: "1"
required: true
description: Polling frequency - how often the polling command should run (minutes)
- key: Timeout
value:
simple: "10"
required: true
description: How much time to poll before declaring a timeout and resuming the playbook
(minutes)
- key: dt
value: {}
required: true
description: DT filter for polling IDs
outputs: []