forked from aliyun/oos-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACS-ECS-BulkyRunCommand.json
152 lines (152 loc) · 4.75 KB
/
ACS-ECS-BulkyRunCommand.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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"en": "Bulky run command on ECS instances.",
"zh-cn": "\u6279\u91cf\u5728\u591a\u53f0ECS\u5b9e\u4f8b\u4e0a\u8fd0\u884c\u4e91\u52a9\u624b\u547d\u4ee4\u3002",
"name-en": "ACS-ECS-BulkyRunCommand",
"name-zh-cn": "\u6279\u91cf\u5728ECS\u5b9e\u4f8b\u4e0a\u8fd0\u884c\u547d\u4ee4",
"categories": [
"run_command"
]
},
"Parameters": {
"regionId": {
"Type": "String",
"Description": {
"en": "The id of region.",
"zh-cn": "\u5730\u57dfID\u3002"
},
"AssociationProperty": "RegionId",
"Default": "{{ ACS::RegionId }}"
},
"targets": {
"Type": "Json",
"AssociationProperty": "Targets",
"AssociationPropertyMetadata": {
"ResourceType": "ALIYUN::ECS::Instance",
"RegionId": "regionId"
}
},
"commandType": {
"Description": {
"en": "The type of command.",
"zh-cn": "\u4e91\u52a9\u624b\u547d\u4ee4\u7c7b\u578b\u3002"
},
"Type": "String",
"AllowedValues": [
"RunBatScript",
"RunPowerShellScript",
"RunShellScript"
],
"Default": "RunShellScript"
},
"commandContent": {
"Description": {
"en": "Command content to run in ECS instance.",
"zh-cn": "\u5728ECS\u5b9e\u4f8b\u4e2d\u6267\u884c\u7684\u4e91\u52a9\u624b\u547d\u4ee4\u3002"
},
"Type": "String",
"AssociationProperty": "Code",
"Default": "echo hello"
},
"workingDir": {
"Description": {
"en": "The directory where the created command runs on the ECS instances.Linux instances: under the home directory of the administrator (root user): /root.Windows instances: under the directory where the process of the Cloud Assistant client is located, such asC:\\Windows\\System32.",
"zh-cn": "\u811a\u672c\u5728ECS\u5b9e\u4f8b\u4e2d\u7684\u8fd0\u884c\u76ee\u5f55\u3002Linux\u7cfb\u7edf\u5b9e\u4f8b\u9ed8\u8ba4\u5728\u7ba1\u7406\u5458\uff08root\u7528\u6237\uff09\u7684home\u76ee\u5f55\u4e0b\uff0c\u5373/root\u3002Windows\u7cfb\u7edf\u5b9e\u4f8b\u9ed8\u8ba4\u5728\u4e91\u52a9\u624b\u5ba2\u6237\u7aef\u8fdb\u7a0b\u6240\u5728\u76ee\u5f55\uff0c\u4f8b\u5982C:\\Windows\\System32\u3002"
},
"Type": "String",
"Default": ""
},
"timeout": {
"Description": {
"en": "The value of the invocation timeout period of a command on ECS instances.",
"zh-cn": "ECS\u5b9e\u4f8b\u4e2d\u6267\u884c\u547d\u4ee4\u7684\u8d85\u65f6\u65f6\u95f4\u3002"
},
"Type": "Number",
"Default": 600
},
"rateControl": {
"Description": {
"en": "Concurrency ratio of task execution.",
"zh-cn": "\u4efb\u52a1\u6267\u884c\u7684\u5e76\u53d1\u6bd4\u7387\u3002"
},
"Type": "Json",
"AssociationProperty": "RateControl",
"Default": {
"Mode": "Concurrency",
"MaxErrors": 0,
"Concurrency": 10
}
},
"OOSAssumeRole": {
"Description": {
"en": "The RAM role to be assumed by OOS.",
"zh-cn": "OOS\u626e\u6f14\u7684RAM\u89d2\u8272\u3002"
},
"Type": "String",
"Default": "OOSServiceRole"
}
},
"RamRole": "{{ OOSAssumeRole }}",
"Tasks": [
{
"Name": "getInstance",
"Description": {
"en": "Views the ECS instances.",
"zh-cn": "\u83b7\u53d6ECS\u5b9e\u4f8b\u3002"
},
"Action": "ACS::SelectTargets",
"Properties": {
"ResourceType": "ALIYUN::ECS::Instance",
"RegionId": "{{ regionId }}",
"Filters": [
"{{ targets }}"
]
},
"Outputs": {
"instanceIds": {
"Type": "List",
"ValueSelector": "Instances.Instance[].InstanceId"
}
}
},
{
"Name": "runCommand",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Execute cloud assistant command.",
"zh-cn": "\u6267\u884c\u4e91\u52a9\u624b\u547d\u4ee4\u3002"
},
"Properties": {
"regionId": "{{ regionId }}",
"commandContent": "{{ commandContent }}",
"instanceId": "{{ ACS::TaskLoopItem }}",
"commandType": "{{ commandType }}",
"workingDir": "{{ workingDir }}",
"timeout": "{{ timeout }}"
},
"Loop": {
"RateControl": "{{ rateControl }}",
"Items": "{{ getInstance.instanceIds }}",
"Outputs": {
"commandOutputs": {
"AggregateType": "Fn::ListJoin",
"AggregateField": "commandOutput"
}
}
},
"Outputs": {
"commandOutput": {
"Type": "String",
"ValueSelector": "invocationOutput"
}
}
}
],
"Outputs": {
"commandOutputs": {
"Type": "List",
"Value": "{{ runCommand.commandOutputs }}"
}
}
}