Nome do modelo
ACS-ECS-ScheduleToCleanUpDisks: Limpeza de discos
Descrição do modelo
Agenda tarefas periódicas de limpeza de disco em instâncias do Elastic Compute Service (ECS), como a remoção automática de arquivos de log e a exclusão de arquivos temporários. É necessário especificar um gatilho de temporizador (timerTrigger), o ID da região (regionId), as instâncias de destino (targets) e as regras de limpeza (cleanUpInfos). Após a execução, o modelo retorna a saída do comando de limpeza, permitindo que você verifique o status da operação nos discos.
Tipo de modelo
Automatizado
Proprietário
Alibaba Cloud
Parâmetros de entrada
|
Parâmetro |
Descrição |
Tipo |
Obrigatório |
Valor padrão |
Limite |
|
timerTrigger |
Configuração de agendamento para a tarefa de limpeza. |
Json |
Sim |
||
|
targets |
Instâncias ECS de destino. |
Json |
Sim |
||
|
cleanUpInfos |
Regras para limpeza de disco. |
String |
Sim |
Expressão regular de validação de string: ^["$`'\s]+$ |
|
|
regionId |
ID da região. |
String |
Não |
{{ ACS::RegionId }} |
|
|
rateControl |
Concorrência na execução da tarefa. |
Json |
Não |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
Função RAM assumida pelo OOS. |
String |
Não |
OOSServiceRole |
Parâmetros de saída
|
Parâmetro |
Descrição |
Tipo |
|
commandOutputs |
List |
Política de permissões necessária para executar o modelo
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Detalhes
Para mais informações, consulte o arquivo ACS-ECS-ScheduleToCleanUpDisks.yml no GitHub.
Conteúdo do modelo
FormatVersion: OOS-2019-06-01
Description:
en: 'Schedules disk cleanup tasks. This template is useful for scenarios that require periodic management and cleanup of disk space on ECS instances, such as automatic log file cleanup and temporary file deletion. During configuration, provide the following required parameters: a timer trigger (timerTrigger) to define when the cleanup task runs, a region ID (regionId) to specify the region of the target ECS instances, target instances (targets) to define the specific ECS instances to operate on, and cleanup rules (cleanUpInfos) to specify the disk cleanup rules. After execution, the template returns a list of output from the cleanup command. This lets you verify the status of the disk cleanup operations.'
zh-cn: Schedules disk cleanup tasks. This template is useful for scenarios that require periodic management and cleanup of disk space on ECS instances, such as automatic log file cleanup and temporary file deletion. During configuration, provide the following required parameters: a timer trigger (timerTrigger) to define when the cleanup task runs, a region ID (regionId) to specify the region of the target ECS instances, target instances (targets) to define the specific ECS instances to operate on, and cleanup rules (cleanUpInfos) to specify the disk cleanup rules. After execution, the template returns a list of output from the cleanup command. This lets you verify the status of the disk cleanup operations.
name-en: Clean up disks
name-zh-cn: Clean up disks
categories:
- time_trigger
- application_manage
- computenest
Parameters:
timerTrigger:
Type: Json
Label:
en: Timer trigger
zh-cn: Timer trigger
AssociationProperty: ALIYUN::OOS::Component::TimerTrigger
AssociationPropertyMetadata:
MinuteInterval: 30
regionId:
Type: String
Label:
en: Region ID
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: Target instance
zh-cn: Target instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
Status: Running
cleanUpInfos:
Description:
en: 'Format: 3d|/root/log/|*.log,3h|/root/log/|*.access,30m|C:\Users\Administrator\log\|*.log.'
zh-cn: 'Format: 3d|/root/log/|*.log,3h|/root/log/|*.access,30m|C:\Users\Administrator\log\|*.log'
Label:
en: Cleanup rule
zh-cn: Cleanup rule
Type: String
AssociationProperty: ALIYUN::OOS::Component::CleanUpInfo
AllowedPattern: "^[^\"$`'\s]+$"
rateControl:
Label:
en: Rate control
zh-cn: Task execution concurrency rate
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: RAM role assumed by OOS
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: 'ACS::TimerTrigger'
Description:
en: Triggers a task as scheduled by specifying a type and expression.
zh-cn: Triggers the task based on the specified trigger type and expression.
Properties:
Type:
'Fn::Select':
- type
- '{{timerTrigger}}'
Expression:
'Fn::Select':
- expression
- '{{timerTrigger}}'
StartDate:
'Fn::Select':
- startDate
- '{{ timerTrigger }}'
EndDate:
'Fn::Select':
- endDate
- '{{ timerTrigger }}'
TimeZone:
'Fn::Select':
- timeZone
- '{{ timerTrigger }}'
- Name: getInstance
Description:
en: Views the ECS instances.
zh-cn: Gets the ECS instances.
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: cleanUpDisk
Action: 'ACS::ECS::CleanUpDisk'
Description:
en: Runs a Cloud Assistant command to clean up the disk.
zh-cn: Runs a Cloud Assistant command to clean up the disk.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
cleanUpInfos: '{{ cleanUpInfos }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutputs:
Type: List
Value: '{{ cleanUpDisk.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- timerTrigger
Label:
default:
zh-cn: Cleanup time
en: Cleanup time
- Parameters:
- cleanUpInfos
Label:
default:
zh-cn: Rule settings
en: Rule settings
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Instance selection
en: Instance selection
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced options
en: Advanced options
Instruções
Leia o conteúdo em inglês para compreender O QUE precisa ser comunicado
Escreva o texto em português do Brasil DO ZERO — esqueça a estrutura das frases em inglês
Preserve toda a formatação markdown, blocos de código, links e imagens exatamente como estão
Tags xref (
<a data-tag="xref" ...>texto</a>) — preserve a tag INTEIRA com todos os atributos na ordem e caixa originais, traduza APENAS o texto visível entre > eAplique todas as regras específicas do idioma rigorosamente
Aplique as regras de stopwords com tolerância zero
Use o modo imperativo em etapas numeradas e listas de procedimentos
Garanta a consistência terminológica — o mesmo termo deve ter a mesma tradução em todo o documento
Varie os inícios de frase em listas e tabelas — nenhum início deve se repetir 3 ou mais vezes
Retorne APENAS o documento markdown em português do Brasil, sem explicações