テンプレート名
ACS-LOG-BulkyInstallLogtail
テンプレートの説明
複数の Elastic Compute Service (ECS) インスタンスに Logtail を一度にインストールします。
テンプレートの種類
自動化
所有者
Alibaba Cloud
入力パラメータ
パラメータ | 説明 | データ型 | 必須 | デフォルト値 | 制限 |
targets | 宛先インスタンス。 | Json | はい | ||
regionId | リージョン ID。 | String | いいえ | {{ ACS::RegionId }} | |
action | 操作タイプ。 | String | いいえ | install | |
overwrite | ECS インスタンスに Logtail が既にインストールされている場合、Logtail の構成を上書きするかどうかを指定します。 | String | いいえ | false | |
rateControl | レート制御設定。 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | CloudOps Orchestration Service ( OOS ) によって引き受けられる RAM ロール。 | 文字列 | いいえ | "" |
出力パラメーター
パラメーター | 説明 | データ型 |
commandOutput | 文字列 |
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:InvokeCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: Use this template to install sls logtail on ecs
name-en: ACS-LOG-BulkyInstallLogtail
categories:
- run_command
Parameters:
regionId:
Type: String
Label:
en: RegionId
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
action:
Type: String
Label:
en: Action
AllowedValues:
- install
- upgrade
- uninstall
Default: install
overwrite:
Description:
en: If Logtail exists in the instance, choose whether to overwrite Logtail(Default no).
Label:
en: Overwrite
Type: String
AllowedValues:
- 'true'
- 'false'
Default: 'false'
targets:
Type: Json
Label:
en: TargetInstance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
rateControl:
Label:
en: RateControl
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
instanceInfos:
Type: List
ValueSelector: .Instances.Instance[] | {"osType":.OSType, "instanceId":.InstanceId}
- Name: invokeCommand
Action: ACS::ECS::InvokeCommand
Properties:
instanceId: '{{ ACS::TaskLoopItem }}'
regionId: '{{ regionId }}'
parameters:
regionid: '{{ regionId }}'
action: '{{ action }}'
overwrite: '{{ overwrite }}'
commandId:
Fn::If:
- Fn::Equals:
- Fn::Jq:
- First
- .|map(select(.instanceId == "{{ ACS::TaskLoopItem }}").osType)[]
- '{{ getInstance.instanceInfos }}'
- linux
- cmd-ACS-LOG-InstallLogtail-for-linux.sh
- cmd-ACS-LOG-InstallLogtail-for-windows.ps1
Loop:
Items: '{{ getInstance.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
commandOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Outputs:
commandOutput:
Type: String
Value: '{{ invokeCommand.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- action
- overwrite
Label:
default:
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
en: Select Ecs Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Control Options