-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::ECS::RunImageTemplateCommand.yml
94 lines (94 loc) · 2.67 KB
/
ACS::ECS::RunImageTemplateCommand.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::RunImageTemplateCommand
name-zh-cn: 在ECS实例上跨多个区域运行命令或重启实例
en: Bulky run command or reboot instance on ECS instance across multiple regions
zh-cn: 在ECS实例上跨多个区域运行命令或重启实例
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
instanceId:
Description:
en: The ID of ECS instance
zh-cn: ECS实例ID
Type: String
parameters:
Description:
en: 'The parameters of template tasks e.g.{"type": "RESTART"} or { "commandType":
"RunShellScript", "commandContent": "pwd", "workingDir": "/root", "type": "RunCommand",
"timeout": 600 }.'
zh-cn: '模板任务参数:{"type": "RESTART"}或{" commandType": "RunShellScript", "commandContent":
"pwd", "workingDir": "/root", "type": "RunCommand", "timeout": 600}'
Type: Json
Tasks:
- Name: rebootInstance
When:
'Fn::Equals':
- RESTART
- 'Fn::Select':
- type
- '{{ parameters }}'
Action: 'ACS::ECS::RebootInstance'
Description:
en: Restarts the ECS instances
zh-cn: 重启实例
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
- Name: installCloudAssistant
When:
'Fn::Equals':
- RESTART
- 'Fn::Select':
- type
- '{{ parameters }}'
Action: ACS::ECS::InstallCloudAssistant
Description:
en: Install cloud assostant for ECS instance
zh-cn: 为ECS实例安装云助手
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
- Name: runCommand
Action: 'ACS::ECS::RunCommand'
When:
Fn::Not:
'Fn::Equals':
- RESTART
- 'Fn::Select':
- type
- '{{ parameters }}'
Description:
en: Executes cloud assistant command
zh-cn: 执行云助手命令
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
commandContent:
'Fn::Select':
- commandContent
- '{{ parameters }}'
commandType:
'Fn::Select':
- commandType
- '{{ parameters }}'
workingDir:
'Fn::Select':
- workingDir
- '{{ parameters }}'
timeout:
'Fn::Jq':
- First
- .timeout| if .==null then 600|tonumber else .|tonumber end
- '{{ parameters }}'
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Outputs:
commandOutput:
Type: String
Value: '{{ runCommand.commandOutput }}'