首頁(yè)
系統(tǒng)運(yùn)維管理
操作指南
自動(dòng)化任務(wù)
模板
公共模板
TAG
ACS-TAG-ExtendEcsInstanceTagsByInputParams
ACS-TAG-ExtendEcsInstanceTagsByInputParams
更新時(shí)間:
模板名稱
ACS-TAG-ExtendEcsInstanceTagsByInputParams Ecs實(shí)例相關(guān)資源(Disk、Image、Snapshot、EIP、ENI)繼承實(shí)例的標(biāo)簽
模板描述
Ecs實(shí)例相關(guān)資源(Disk、Image、Snapshot、EIP、ENI)繼承實(shí)例的標(biāo)簽
模板類型
自動(dòng)化
所有者
Alibaba Cloud
輸入?yún)?shù)
參數(shù)名稱 | 描述 | 類型 | 是否必填 | 默認(rèn)值 | 約束 |
targets | 目標(biāo)實(shí)例 | Json | 是 | ||
tagKeys | 所需繼承的標(biāo)簽鍵列表 | List | 是 | ||
resourceTypes | 繼承標(biāo)簽的資源類型列表 | List | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
isUpdate | 是否覆蓋標(biāo)簽值 | Boolean | 否 | False | |
rateControl | 任務(wù)執(zhí)行的并發(fā)比率 | Json | 否 | {'Mode': 'Concurrency', 'MaxErrors': 100, 'Concurrency': 50} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | "" |
輸出參數(shù)
無(wú)
執(zhí)行此模板需要的權(quán)限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeDisks",
"ecs:DescribeImages",
"ecs:DescribeInstances",
"ecs:DescribeNetworkInterfaces",
"ecs:DescribeSnapshots",
"ecs:TagResources"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"vpc:ListTagResources",
"vpc:TagResources"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-TAG-ExtendEcsInstanceTagsByInputParams詳情
模板內(nèi)容
FormatVersion: OOS-2019-06-01
Description:
en: Ecs instance related resources (Disk, Image, Snapshot, EIP, ENI) inherit the Tags of the Instance
zh-cn: Ecs實(shí)例相關(guān)資源(Disk、Image、Snapshot、EIP、ENI)繼承實(shí)例的標(biāo)簽
name-en: ACS-TAG-ExtendEcsInstanceTagsByInputParams
name-zh-cn: Ecs實(shí)例相關(guān)資源(Disk、Image、Snapshot、EIP、ENI)繼承實(shí)例的標(biāo)簽
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Label:
en: TargetInstance
zh-cn: 目標(biāo)實(shí)例
Type: Json
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
tagKeys:
Label:
en: TagKeys
zh-cn: 所需繼承的標(biāo)簽鍵列表
Type: List
resourceTypes:
Label:
en: ResourceTypes
zh-cn: 繼承標(biāo)簽的資源類型列表
Type: List
AllowedValues:
- disk
- snapshot
- eni
- eip
- image
isUpdate:
Label:
en: IsUpdate
zh-cn: 是否覆蓋標(biāo)簽值
Description:
en: Whether to overwrite the tag value if the tag key is the same
zh-cn: 如果標(biāo)簽鍵相同,是否覆蓋標(biāo)簽值
Type: Boolean
Default: false
rateControl:
Label:
en: RateControl
zh-cn: 任務(wù)執(zhí)行的并發(fā)比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100
Concurrency: 50
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstanceTagResources
Description:
en: Query the ECS instances
zh-cn: 獲取ECS實(shí)例以及標(biāo)簽信息
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
desData:
Type: List
ValueSelector: '.Instances.Instance[] | {"Tags": .Tags.Tag | map(select( .TagKey | test("^(?!acs).*"))) | map(select(.TagKey as $tagKey | {{tagKeys}} | index($tagKey) >=0)) , "InstanceId": .InstanceId}?'
- Name: isTagDisk
Action: ACS::Choice
Description:
en: Disk Extend Tags
zh-cn: 磁盤(pán)是否繼承的標(biāo)簽
Properties:
DefaultTask: isTagSnapshot
Choices:
- When:
Fn::Equals:
- true
- Fn::Jq:
- First
- contains(["disk"])
- '{{resourceTypes}}'
NextTask: tagDisk
- Name: tagDisk
Action: ACS::Template
Description:
en: Update disk tags by ecs instance tags
zh-cn: 通過(guò)云服務(wù)器標(biāo)簽同步更新磁盤(pán)標(biāo)簽
OnSuccess: isTagSnapshot
Properties:
TemplateName: ACS::ECS::UpdateDiskTagsByEcsInstanceTags
Parameters:
regionId: '{{ regionId }}'
instanceId:
Fn::Jq:
- First
- .InstanceId
- '{{ACS::TaskLoopItem}}'
tagKeys: '{{tagKeys}}'
isUpdate: '{{isUpdate}}'
Loop:
RateControl: '{{rateControl}}'
Items: '{{getInstanceTagResources.desData}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: reqResult
- Name: isTagSnapshot
Action: ACS::Choice
Description:
en: Snapshot Extend Tags
zh-cn: 快照是否繼承標(biāo)簽
Properties:
DefaultTask: isTagENI
Choices:
- When:
Fn::Equals:
- true
- Fn::Jq:
- First
- contains(["snapshot"])
- '{{resourceTypes}}'
NextTask: tagSnapshot
- Name: tagSnapshot
Action: ACS::Template
Description:
en: Update snapshot tags by ecs instance tags
zh-cn: 通過(guò)云服務(wù)器標(biāo)簽同步更新快照標(biāo)簽
OnSuccess: isTagENI
Properties:
TemplateName: ACS::ECS::UpdateSnapshotTagsByEcsInstanceTags
Parameters:
regionId: '{{regionId}}'
instanceId:
Fn::Jq:
- First
- .InstanceId
- '{{ACS::TaskLoopItem}}'
tagKeys: '{{tagKeys}}'
isUpdate: '{{isUpdate}}'
Loop:
RateControl: '{{rateControl}}'
Items: '{{getInstanceTagResources.desData}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: reqResult
- Name: isTagENI
Action: ACS::Choice
Description:
en: ENI Extend Tags
zh-cn: ENI 是否繼承標(biāo)簽
Properties:
DefaultTask: isTagEIP
Choices:
- When:
Fn::Equals:
- true
- Fn::Jq:
- First
- contains(["eni"])
- '{{resourceTypes}}'
NextTask: tagENI
- Name: tagENI
Action: ACS::Template
Description:
en: Update eni tags by ecs instance tags
zh-cn: 通過(guò)云服務(wù)器標(biāo)簽同步更新eni標(biāo)簽
OnSuccess: isTagEIP
Properties:
TemplateName: ACS::ECS::UpdateEniTagsByEcsInstanceTags
Parameters:
regionId: '{{ regionId }}'
instanceId:
Fn::Jq:
- First
- .InstanceId
- '{{ACS::TaskLoopItem}}'
tagKeys: '{{tagKeys}}'
isUpdate: '{{isUpdate}}'
Loop:
RateControl: '{{rateControl}}'
Items: '{{getInstanceTagResources.desData}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: reqResult
- Name: isTagEIP
Action: ACS::Choice
Description:
en: Choose next task by resource type
zh-cn: 根據(jù)資源類型選擇下一個(gè)任務(wù)
Properties:
DefaultTask: isTagImage
Choices:
- When:
Fn::Equals:
- true
- Fn::Jq:
- First
- contains(["eni"])
- '{{resourceTypes}}'
NextTask: tagEIP
- Name: tagEIP
Action: ACS::Template
Description:
en: Update eip tags By ecs instance tags
zh-cn: 通過(guò)云服務(wù)器標(biāo)簽同步更新EIP標(biāo)簽
OnSuccess: isTagImage
Properties:
TemplateName: ACS::ECS::UpdateEipTagsByEcsInstanceTags
Parameters:
regionId: '{{ regionId }}'
instanceId:
Fn::Jq:
- First
- .InstanceId
- '{{ACS::TaskLoopItem}}'
tagKeys: '{{tagKeys}}'
isUpdate: '{{isUpdate}}'
Loop:
RateControl: '{{rateControl}}'
Items: '{{getInstanceTagResources.desData}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: reqResult
- Name: isTagImage
Action: ACS::Choice
Description:
en: Choose next task by resource type
zh-cn: 根據(jù)資源類型選擇下一個(gè)任務(wù)
Properties:
DefaultTask: ACS::END
Choices:
- When:
Fn::Equals:
- true
- Fn::Jq:
- First
- contains(["image"])
- '{{resourceTypes}}'
NextTask: tagImage
- Name: tagImage
Action: ACS::Template
Description:
en: Update custom image tags By ecs instance tags
zh-cn: 通過(guò)云服務(wù)器標(biāo)簽同步更新Image標(biāo)簽(只包括自定義鏡像)
OnSuccess: ACS::END
Properties:
TemplateName: ACS::ECS::UpdateCustomImageTagsByEcsInstanceTags
Parameters:
regionId: '{{ regionId }}'
instanceId:
Fn::Jq:
- First
- .InstanceId
- '{{ACS::TaskLoopItem}}'
tagKeys: '{{tagKeys}}'
isUpdate: '{{isUpdate}}'
Loop:
RateControl: '{{rateControl}}'
Items: '{{getInstanceTagResources.desData}}'
Outputs:
tagResult:
AggregateType: Fn::ListJoin
AggregateField: reqResult
文檔內(nèi)容是否對(duì)您有幫助?