模板名稱
ACS-ECS-ScheduleApplyPatchBaseline 定時在ECS實例中配置補丁基線
模板描述
定時在ECS實例中配置補丁基線
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 默認值 | 約束 |
targets | 目標實例 | Json | 是 | ||
timerTrigger | 定時類型 | Json | 是 | ||
regionId | 地域ID | String | 否 | {{ ACS::RegionId }} | |
resourceType | 資源類型 | String | 否 | ALIYUN::ECS::Instance | |
action | 執行方式 | String | 否 | install | |
whetherCreateSnapshot | 是否為系統盤創建快照 | Boolean | 否 | False | |
retentionDays | 快照保留天數 | Number | 否 | 7 | |
rebootIfNeed | 是否重啟 | Boolean | 否 | False | |
timeout | ECS實例中執行命令的超時時間 | Number | 否 | 7200 | |
rateControl | 任務執行的并發比率 | Json | 否 | {‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10} | |
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數
參數名稱 | 描述 | 類型 |
commandOutputs | List |
執行此模板需要的權限策略
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateSnapshot",
"ecs:DescribeCloudAssistantStatus",
"ecs:DescribeDisks",
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:DescribeManagedInstances",
"ecs:DescribeSnapshots",
"ecs:RebootInstance",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecd:CreateSnapshot",
"ecd:DescribeCloudAssistantStatus",
"ecd:DescribeDesktops",
"ecd:DescribeInvocations",
"ecd:DescribeSnapshots",
"ecd:RebootDesktops",
"ecd:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:ListInstancePatchStates"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-ScheduleApplyPatchBaseline詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS-ECS-ScheduleApplyPatchBaseline
name-zh-cn: 定時在ECS實例中配置補丁基線
en: Schedule to apply patch baseline on ECS instance
zh-cn: 定時在ECS實例中配置補丁基線
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
resourceType:
Type: String
Label:
en: ResourceType
zh-cn: 資源類型
AssociationPropertyMetadata:
LocaleKey: TargetResourceType
AllowedValues:
- ALIYUN::ECS::Instance
- ALIYUN::ECS::ManagedInstance
- ALIYUN::ECD::Desktop
Default: ALIYUN::ECS::Instance
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目標實例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: resourceType
RegionId: regionId
Status: Running
timerTrigger:
Type: Json
Label:
en: TimerTrigger
zh-cn: 定時類型
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
action:
Label:
en: Action
zh-cn: 執行方式
Type: String
AllowedValues:
- install
- scan
Default: install
AssociationPropertyMetadata:
LocaleKey: OOSPatchExecuteType
whetherCreateSnapshot:
Label:
en: WhetherCreateSnapshot
zh-cn: 是否為系統盤創建快照
Type: Boolean
Default: false
AssociationPropertyMetadata:
Visible:
Condition:
'Fn::Equals':
- '${action}'
- install
retentionDays:
Label:
en: RetentionDays
zh-cn: 快照保留天數
Type: Number
MinValue: 1
MaxValue: 65536
Default: 7
AssociationPropertyMetadata:
Visible:
Condition:
'Fn::Equals':
- '${whetherCreateSnapshot}'
- true
rebootIfNeed:
Label:
en: RebootIfNeed
zh-cn: 是否重啟
Type: Boolean
Default: false
AssociationPropertyMetadata:
Visible:
Condition:
'Fn::Equals':
- '${action}'
- install
timeout:
Label:
en: Timeout
zh-cn: ECS實例中執行命令的超時時間
Type: Number
Default: 7200
rateControl:
Label:
en: RateControl
zh-cn: 任務執行的并發比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
AssociationPropertyMetadata:
TimerTrigger: '${timerTrigger}'
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying type and expression
zh-cn: 通過指定觸發類型和表達式按計劃觸發任務
Properties:
Type:
Fn::Select:
- type
- '{{timerTrigger}}'
Expression:
Fn::Select:
- expression
- '{{timerTrigger}}'
EndDate:
Fn::Select:
- endDate
- '{{ timerTrigger }}'
TimeZone:
Fn::Select:
- timeZone
- '{{ timerTrigger }}'
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: 獲取ECS實例
Action: ACS::SelectTargets
Properties:
RegionId: '{{ regionId }}'
ResourceType: '{{ resourceType }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: applyPatchBaseline
Description:
en: Apply patch baseline on ECS instance
zh-cn: 在ECS實例中配置補丁基線
Action: ACS::ECS::ApplyPatchBaseline
When:
Fn::Equals:
- '{{ resourceType }}'
- ALIYUN::ECS::Instance
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
action: '{{ action }}'
whetherCreateSnapshot: '{{ whetherCreateSnapshot }}'
retentionDays: '{{ retentionDays }}'
rebootIfNeed: '{{ rebootIfNeed }}'
timeout: '{{ timeout }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
- Name: applyPatchBaselineOnManagedInstance
Description:
en: Apply patch baseline on ECS managed instance
zh-cn: 在ECS托管實例中配置補丁基線
Action: ACS::ECS::ApplyPatchBaselineOnMangedInstance
When:
Fn::Equals:
- '{{ resourceType }}'
- ALIYUN::ECS::ManagedInstance
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
action: '{{ action }}'
timeout: '{{ timeout }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
- Name: applyPatchBaselineOnECDInstance
Description:
en: Apply patch baseline on ECD instance
zh-cn: 在ECD實例中配置補丁基線
Action: ACS::ECD::ApplyPatchBaseline
When:
Fn::Equals:
- '{{ resourceType }}'
- ALIYUN::ECD::Desktop
Properties:
regionId: '{{ regionId }}'
desktopId: '{{ ACS::TaskLoopItem }}'
action: '{{ action }}'
rebootIfNeed: '{{ rebootIfNeed }}'
whetherCreateSnapshot: '{{ whetherCreateSnapshot }}'
timeout: '{{ timeout }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutputs:
Type: List
Value: '{{ applyPatchBaseline.commandOutputs }}'
文檔內容是否對您有幫助?