All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-ScheduleToCollectInventoryData

Last Updated:Nov 25, 2024

Template name

ACS-ECS-ScheduleToCollectInventoryData

Execute Now

Template description

Collects inventory data as scheduled.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

linuxOptions

The options that are specified to collect inventory data in a Linux Elastic Compute Service (ECS) instance.

String

Yes

windowsOptions

The options that are specified to collect inventory data in a Windows ECS instance.

String

Yes

targets

The ECS instances in which you want to collect inventory data.

Json

Yes

regionId

The region ID of the ECS instance.

String

No

{{ ACS::RegionId }}

cron

The CRON expression.

String

No

0 15/30 * ? * *

rateControl

The rate control settings.

Json

No

{'Mode': 'Concurrency', 'MaxErrors': '100%', 'Concurrency': 20}

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

OOSServiceRole

Output parameters

None

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

For more information, see ACS-ECS-ScheduleToCollectInventoryData.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Collect inventory data periodically
  zh-cn: the description in Chinese
  name-en: ACS-ECS-ScheduleToCollectInventoryData
  name-zh-cn: the description in Chinese
  categories:
    - time_trigger
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  linuxOptions:
    Label:
      en: LinuxOptions
      zh-cn: the description in Chinese
    Type: String
  windowsOptions:
    Label:
      en: WindowsOptions
      zh-cn: the description in Chinese
    Type: String
  cron:
    Description:
      en: 'Refer them here: https://help.aliyun.com/document_detail/169784.html'
      zh-cn: the description in Chinese
    Label:
      en: CronExpression
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: Cron
    Default: 0 15/30 * ?  * *
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: the description in Chinese
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 100%
      Concurrency: 20
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: timerTrigger
    Action: 'ACS::TimerTrigger'
    Description:
      en: Triggers a task as scheduled by specifying Cron expression
      zh-cn: the description in Chinese
    Properties:
      Type: cron
      Expression: '{{ cron }}'
      EndDate: '2099-01-01T00:00:00Z'
      TimeZone: UTC
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: the description in Chinese
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
  - Name: putInventory
    Action: 'ACS::ECS::PutInventory'
    Description:
      en: Collect inventory data
      zh-cn: the description in Chinese
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      linuxOptions: '{{ linuxOptions }}'
      windowsOptions: '{{ windowsOptions }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - cron
        Label:
          default:
            zh-cn: the description in Chinese
            en: Timer Trigger Configure
      - Parameters:
          - linuxOptions
          - windowsOptions
        Label:
          default:
            zh-cn: the description in Chinese
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: the description in Chinese
            en: Select Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options