Documentation

ali_ess_group - Create or Terminate an scaling group in ESS.

New in version 1.5.0.

Synopsis

  • A scaling group is a collection of ECS instances with similar configuration deployed in an application scenario. It defines the maximum and minimum number of ECS instances in the group, associated Server Load Balancer and RDS instances, and other attributes.

Requirements

The below requirements are needed on the host that executes this module.

  • footmark >= 1.3.0
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
alicloud_access_key
Aliyun Cloud access key. If not set then the value of environment variable ALICLOUD_ACCESS_KEY, ALICLOUD_ACCESS_KEY_ID will be used instead.

aliases: access_key_id, access_key
alicloud_region
The Aliyun Cloud region to use. If not specified then the value of environment variable ALICLOUD_REGION, ALICLOUD_REGION_ID will be used instead.

aliases: region, region_id
alicloud_secret_key
Aliyun Cloud secret key. If not set then the value of environment variable ALICLOUD_SECRET_KEY, ALICLOUD_SECRET_ACCESS_KEY will be used instead.

aliases: secret_access_key, secret_key
alicloud_security_token
The Aliyun Cloud security token. If not specified then the value of environment variable ALICLOUD_SECURITY_TOKEN will be used instead.

aliases: security_token
configuration_id
ID of the active scaling configuration in the scaling group. Required when state=active.

aliases: scaling_configuration_id
cooldown Default:
300
Default cool-down time (in seconds) of the scaling group. Value range [0, 86400].

aliases: default_cooldown
db_instance_ids
ID list of an RDS instance. At most 8 RDS instance supported.

aliases: db_ids
id
The ID of existing scaling group.

aliases: group_id
load_balancer_ids
ID list of a Server Load Balancer instance. At most 5 Load Balancer instance supported.

aliases: lb_ids
max_size
Maximum number of ECS instances in the scaling group. Value range [0, 100].
min_size
Minimum number of ECS instances in the scaling group. Value range [0, 100]. Required when state=present.
name
Name shown for the scaling group, which must contain 2-40 characters (English or Chinese). The name must begin with a number, an upper/lower-case letter or a Chinese character and may contain numbers, "_", "-" or ".". Default to scaling group ID.

aliases: group_name
removal_policies
    Choices:
  • OldestScalingConfiguration ←
  • NewestInstance
  • OldestInstance ←
Default:
[u'OldestScalingConfiguration', u'OldestInstance']
Policy for removing ECS instances from the scaling group. Optional values OldestInstance(removes the first ECS instance attached to the scaling group); NewestInstance(removes the first ECS instance attached to the scaling group); OldestScalingConfiguration(removes the ECS instance with the oldest scaling configuration).
state
    Choices:
  • present ←
  • active
  • inactive
  • absent
The state of the scaling group after operating.
vswitch_ids
ID list of a VSwitch. At most 8 vswitch supported. The priority of VSwitches descends from 1 to 5, and 1 indicates the highest priority.

aliases: subnet_ids

Notes

Note

  • If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKEN
  • ALICLOUD_REGION or ALICLOUD_REGION_ID can be typically be used to specify the ALICLOUD region, when required, but this can also be configured in the footmark config file

Examples

# basic provisioning example scaling group
- name: basic provisioning example
  hosts: localhost
  vars:
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    alicloud_region: cn-beijing
    ess_group_name: foo
    max_size: 2
    min_size: 0
    cooldown: 400
    removal_policies:
      - 'OldestScalingConfiguration'
      - 'OldestInstance'
    group_id: asg-fh323iwefncew31
    configuration_id: asc-2ze4zleeettwd4sfnrkk

  tasks:
    - name: Create scaling group
      ali_ess_group:
        alicloud_region: '{{ alicloud_region }}'
        max_size: '{{ max_size }}'
        min_size: '{{ min_size }}'
        name: '{{ ess_group_name }}'
        vswitch_ids:
          - '{{ subnet.vswitch_id }}'

    - name: active a specified scaling group
      ali_ess_group:
        alicloud_region: '{{ alicloud_region }}'
        configuration_id: '{{ configuration.id }}'
        id: '{{ group_id }}'
        state: active

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
configuration_id
str
expect absent
ID of the active scaling configuration in the scaling group.

Sample:
asc-2ze4zleeettwd4sfnrkk
group
dict
expect absent
The details of a scaling group.

Sample:
{'status': 'active', 'name': 'foo', 'db_ids': None, 'creation_time': '2018-01-08T05:42Z', 'configuration_id': 'asc-2ze4zleeettwd4sfnrkk', 'min_size': 0, 'cooldown': 300, 'load_balancer_id': None, 'vswitch_ids': ['vsw-2zevfsoh2v7en50w9up6u'], 'id': 'asg-2zefe4bi0jpc3tqi8mn8', 'max_size': 2}
id
str
expect absent
The ID of existing scaling group.

Sample:
asg-2zefe4bi0jpc3tqi8mn8
name
str
expect absent
The ID of existing scaling group.

Sample:
foo


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • He Guimin (@xiaozhu36)

Hint

If you notice any issues in this documentation you can edit this document to improve it.