ALIYUN::DEVOPS::HostGroup类型用于创建主机组。
语法
{
  "Type": "ALIYUN::DEVOPS::HostGroup",
  "Properties": {
    "Name": String,
    "OrganizationId": String,
    "ServiceConnectionId": Integer,
    "AliyunRegion": String,
    "EcsType": String,
    "EnvId": String,
    "EcsLabelValue": String,
    "EcsLabelKey": String,
    "MachineInfos": List,
    "Type": String,
    "TagIds": List
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Name | String | 是 | 是 | 主机组名称。 | 无 | 
| OrganizationId | String | 是 | 否 | 企业标识。 | 您可在云效访问链接中获取。 | 
| ServiceConnectionId | Integer | 是 | 否 | 服务连接ID。 | 无 | 
| AliyunRegion | String | 否 | 否 | 阿里云V。 | 无 | 
| EcsType | String | 否 | 否 | ECS类型。 | 无 | 
| EnvId | String | 否 | 否 | 环境ID。 | 无 | 
| EcsLabelValue | String | 否 | 否 | ECS标签值。 | 无 | 
| EcsLabelKey | String | 否 | 否 | ECS标签键。 | 无 | 
| MachineInfos | List | 否 | 否 | 主机详情配置。 | 更多信息,请参见MachineInfos属性。 | 
| Type | String | 否 | 否 | 主机组类型。 | 目前只支持ECS。 | 
| TagIds | List | 否 | 否 | 标签ID。 | 最多支持10个标签。 | 
MachineInfos语法
"MachineInfos": [
  {
    "InstanceName": String,
    "MachineSn": String,
    "Ip": String,
    "AliyunRegionId": String
  }
]MachineInfos属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| MachineSn | String | 是 | 否 | 实例ID。 | 无 | 
| AliyunRegionId | String | 否 | 否 | 实例I所在的地域ID。 | 无 | 
| InstanceName | String | 否 | 否 | 实例名称。 | 无 | 
| Ip | String | 否 | 否 | 实例绑定的IP。 | 无 | 
返回值
Fn::GetAtt
HostGroupId:主机组ID。
示例
YAML格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ServiceConnectionId:
    Type: Number
    Description:
      en: Service connection.
    Required: true
  OrganizationId:
    Type: String
    Description:
      en: Corporate identity, also known as enterprise id, can obtain in cloud effect access links.
    Required: true
  Name:
    Type: String
    Description:
      en: Host group name.
    Required: true
Resources:
  HostGroup:
    Type: ALIYUN::DEVOPS::HostGroup
    Properties:
      ServiceConnectionId:
        Ref: ServiceConnectionId
      OrganizationId:
        Ref: OrganizationId
      Name:
        Ref: Name
Outputs:
  HostGroupId:
    Description: The id of the host group.
    Value:
      Fn::GetAtt:
        - HostGroup
        - HostGroupIdJSON格式
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ServiceConnectionId": {
      "Type": "Number",
      "Description": {
        "en": "Service connection."
      },
      "Required": true
    },
    "OrganizationId": {
      "Type": "String",
      "Description": {
        "en": "Corporate identity, also known as enterprise id, can obtain in cloud effect access links."
      },
      "Required": true
    },
    "Name": {
      "Type": "String",
      "Description": {
        "en": "Host group name."
      },
      "Required": true
    }
  },
  "Resources": {
    "HostGroup": {
      "Type": "ALIYUN::DEVOPS::HostGroup",
      "Properties": {
        "ServiceConnectionId": {
          "Ref": "ServiceConnectionId"
        },
        "OrganizationId": {
          "Ref": "OrganizationId"
        },
        "Name": {
          "Ref": "Name"
        }
      }
    }
  },
  "Outputs": {
    "HostGroupId": {
      "Description": "The id of the host group.",
      "Value": {
        "Fn::GetAtt": [
          "HostGroup",
          "HostGroupId"
        ]
      }
    }
  }
}
                        该文章对您有帮助吗?