-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::InstallLogtail.json
189 lines (189 loc) · 5.34 KB
/
ACS::ECS::InstallLogtail.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
185
186
187
188
189
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::ECS::InstallLogtail",
"name-zh-cn": "在ECS实例中安装日志服务Agent",
"en": "Install SLS agent on ECS instance",
"zh-cn": "在ECS实例中安装日志服务Agent"
},
"Parameters": {
"regionId": {
"Description": {
"en": "The ID of region",
"zh-cn": "地域ID"
},
"Type": "String",
"Default": "{{ ACS::RegionId }}"
},
"instanceId": {
"Description": {
"en": "The ID of instance to install ilogtail",
"zh-cn": "需要下载SLS客户端的ECS实例ID"
},
"Type": "String",
"MaxLength": 30,
"MinLength": 1
},
"logTailUserDefinedId": {
"Description": {
"en": "The user defined Id write to /etc/ilogtail/user_defined_id",
"zh-cn": "用户需要写入/etc/ilogtail/user_defined_id的DefinedId"
},
"Type": "String",
"MaxLength": 30,
"MinLength": 1
}
},
"Tasks": [
{
"Name": "checkInstanceReady",
"Action": "ACS::CheckFor",
"Description": {
"en": "Check the ECS instance is running status",
"zh-cn": "检测ECS实例为Running状态"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"RegionId": "{{ regionId }}",
"InstanceIds": [
"{{ instanceId }}"
]
},
"DesiredValues": [
"Running"
],
"PropertySelector": "Instances.Instance[].Status"
}
},
{
"Name": "createCommand",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Creates a cloud assistant command to install logtail agent",
"zh-cn": "创建下载log客户端的云助手命令"
},
"Properties": {
"Service": "ECS",
"API": "CreateCommand",
"Parameters": {
"RegionId": "{{ regionId }}",
"CommandContent": {
"Fn::Base64Encode": "wget http://logtail-release-{{ ACS::RegionId }}.oss-{{ ACS::RegionId }}-internal.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install {{ ACS::RegionId }}; echo {{ logTailUserDefinedId }} > /etc/ilogtail/user_defined_id"
},
"Name": "Command_{{ instanceId }}_{{ ACS::ExecutionId }}",
"Type": "RunShellScript"
}
},
"Outputs": {
"commandId": {
"Type": "String",
"ValueSelector": "CommandId"
}
}
},
{
"Name": "invokeCommand",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Triggers a cloud assistant command to install logtail agent",
"zh-cn": "执行下载log客户端的云助手命令"
},
"OnError": "deleteCommand",
"Properties": {
"Service": "ECS",
"API": "InvokeCommand",
"Parameters": {
"RegionId": "{{ regionId }}",
"CommandId": "{{ createCommand.commandId }}",
"InstanceIds": [
"{{ instanceId }}"
]
}
},
"Outputs": {
"invokeId": {
"Type": "String",
"ValueSelector": "InvokeId"
}
}
},
{
"Name": "untilInvocationDone",
"Action": "ACS::WaitFor",
"Description": {
"en": "Waits for the command to be completed",
"zh-cn": "等待云助手命令执行完成"
},
"OnError": "deleteCommand",
"Properties": {
"Service": "ECS",
"API": "DescribeInvocations",
"Parameters": {
"RegionId": "{{ regionId }}",
"InvokeId": "{{ invokeCommand.invokeId }}"
},
"DesiredValues": [
"Finished"
],
"PropertySelector": "Invocations.Invocation[].InvokeStatus"
}
},
{
"Name": "describeInvocationResult",
"Action": "ACS::ExecuteApi",
"Description": {
"en": "Queries the command output of a cloud assistant command in the specified ECS instance",
"zh-cn": "查看在指定ECS实例的云助手命令输出"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInvocationResults",
"Parameters": {
"RegionId": "{{ regionId }}",
"InvokeId": "{{ invokeCommand.invokeId }}"
}
},
"Outputs": {
"exitCode": {
"Type": "Number",
"ValueSelector": "Invocation.InvocationResults.InvocationResult[].ExitCode"
},
"invocationResult": {
"Type": "String",
"ValueSelector": "Invocation.InvocationResults.InvocationResult[].Output"
}
}
},
{
"Name": "deleteCommand",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Cleans up the install ilogtail command",
"zh-cn": "删除下载Log客户端命令"
},
"Properties": {
"Service": "ECS",
"API": "DeleteCommand",
"Risk": "Normal",
"Parameters": {
"RegionId": "{{ regionId }}",
"CommandId": "{{ createCommand.commandId }}"
}
}
}
],
"Outputs": {
"exitCode": {
"Type": "String",
"Value": "{{ describeInvocationResult.exitCode }}"
},
"invocationResult": {
"Type": "String",
"Value": {
"Fn::Base64Decode": "{{ describeInvocationResult.invocationResult }}"
}
}
}
}