-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathACS::ECS::ElegantRunCommandInSLBVServerGroup.json
More file actions
184 lines (184 loc) · 4.44 KB
/
ACS::ECS::ElegantRunCommandInSLBVServerGroup.json
File metadata and controls
184 lines (184 loc) · 4.44 KB
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::ElegantRunCommandInSLBVServerGroup",
"name-zh-cn": "在SLB默认虚拟器组内的实例中执行命令",
"en": "Run the command in the instance of the SLB Vservice group",
"zh-cn": "在SLB默认虚拟器组内的实例中执行命令"
},
"Parameters": {
"regionId": {
"Description": {
"en": "The ID of region",
"zh-cn": "地域ID"
},
"Type": "String",
"Default": "{{ ACS::RegionId }}"
},
"VServerGroupId": {
"Description": {
"en": "The ID of SLB vserver group",
"zh-cn": "SLB虚拟服务器组ID"
},
"Type": "String"
},
"serverId": {
"Description": {
"en": "The ID of ECS instance",
"zh-cn": "ECS实例的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": "在ECS实例中运行的命令"
},
"Type": "String"
}
},
"Tasks": [
{
"Name": "setServerWeightToZero",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Sets server weight to zero",
"zh-cn": "设置服务器权重为0"
},
"OnError": "recoverServerWeight",
"Properties": {
"Service": "SLB",
"API": "SetVServerGroupAttribute",
"Parameters": {
"RegionId": "{{ regionId }}",
"BackendServers": {
"Fn::MergeMapToList": [
{
"ServerId": [
"{{ serverId }}"
]
},
{
"Weight": [
0
]
},
{
"Type": [
"{{ type }}"
]
},
{
"Port": [
"{{ port }}"
]
}
]
},
"VServerGroupId": "{{ VServerGroupId }}"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Runs cloud assistant command",
"zh-cn": "执行cloud assistant命令"
},
"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": "SetVServerGroupAttribute",
"Parameters": {
"RegionId": "{{ regionId }}",
"BackendServers": {
"Fn::MergeMapToList": [
{
"ServerId": [
"{{ serverId }}"
]
},
{
"Weight": [
"{{ weight }}"
]
},
{
"Type": [
"{{ type }}"
]
},
{
"Port": [
"{{ port }}"
]
}
]
},
"VServerGroupId": "{{ VServerGroupId }}"
}
}
}
],
"Outputs": {
"commandOutput": {
"Type": "String",
"Value": "{{ runCommand.commandOutput }}"
}
}
}