-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::ElegantRunCommandInSLBDefaultServerGroup.json
184 lines (184 loc) · 4.43 KB
/
ACS::ECS::ElegantRunCommandInSLBDefaultServerGroup.json
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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::ECS::ElegantRunCommandInSLBDefaultServerGroup",
"name-zh-cn": "在SLB默认服务器组内的实例中执行命令",
"en": "Run the command in the instance of the SLB default service group",
"zh-cn": "在SLB默认服务器组内的实例中执行命令"
},
"Parameters": {
"regionId": {
"Description": {
"en": "The ID of region",
"zh-cn": "地域ID"
},
"Type": "String",
"Default": "{{ ACS::RegionId }}"
},
"loadBalancerId": {
"Description": {
"en": "The ID of the SLB instance",
"zh-cn": "SLB实例ID"
},
"Type": "String"
},
"serverId": {
"Description": {
"en": "The ID of server",
"zh-cn": "后端服务器ID"
},
"Type": "String"
},
"weight": {
"Description": {
"en": "The weight of server",
"zh-cn": "后端服务器权重"
},
"Type": "Number"
},
"type": {
"Description": {
"en": "The type of server",
"zh-cn": "后端服务器类型"
},
"Type": "String"
},
"port": {
"Description": {
"en": "The port of server",
"zh-cn": "后端服务器端口"
},
"Type": "Number"
},
"commandType": {
"Description": {
"en": "The type of command",
"zh-cn": "云助手命令类型"
},
"Type": "String",
"AllowedValues": [
"RunBatScript",
"RunPowerShellScript",
"RunShellScript"
],
"Default": "RunShellScript"
},
"commandContent": {
"Description": {
"en": "Command content to run in ECS instance",
"zh-cn": "后端服务器中执行的命令"
},
"Type": "String"
}
},
"Tasks": [
{
"Name": "setServerWeightToZero",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Sets server weight to zero",
"zh-cn": "把后端服务器权重设置为0"
},
"OnError": "recoverServerWeight",
"Properties": {
"Service": "SLB",
"API": "SetBackendServers",
"Parameters": {
"RegionId": "{{ regionId }}",
"BackendServers": {
"Fn::MergeMapToList": [
{
"ServerId": [
"{{ serverId }}"
]
},
{
"Weight": [
0
]
},
{
"Type": [
"{{ type }}"
]
},
{
"Port": [
"{{ port }}"
]
}
]
},
"LoadBalancerId": "{{ loadBalancerId }}"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Runs cloud assistant command",
"zh-cn": "执行云助手命令"
},
"OnError": "recoverServerWeight",
"Properties": {
"regionId": "{{ regionId }}",
"instanceId": "{{ serverId }}",
"commandType": "{{ commandType }}",
"commandContent": "{{ commandContent }}"
},
"Outputs": {
"commandOutput": {
"Type": "String",
"ValueSelector": "invocationOutput"
}
}
},
{
"Name": "recoverServerWeight",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Sets the server weight to the original value",
"zh-cn": "将服务器权重设置为原始值"
},
"Properties": {
"Service": "SLB",
"API": "SetBackendServers",
"Parameters": {
"RegionId": "{{ regionId }}",
"BackendServers": {
"Fn::MergeMapToList": [
{
"ServerId": [
"{{ serverId }}"
]
},
{
"Weight": [
"{{ weight }}"
]
},
{
"Type": [
"{{ type }}"
]
},
{
"Port": [
"{{ port }}"
]
}
]
},
"LoadBalancerId": "{{ loadBalancerId }}"
}
}
}
],
"Outputs": {
"commandOutput": {
"Type": "String",
"Value": "{{ runCommand.commandOutput }}"
}
}
}