Documentation

alicloud_ess_instance - Add or Remove several ECS instances in ESS

DEPRECATED

Removed in Ansible:
 version: 1.5.0
Why:Alibaba Cloud module name prefix “ali” will be more concise.
Alternative:Use ali_ess_instance instead.

Synopsis

  • Add several ECS instances to a specified scaling group; Remove several ECS instances from a specified scaling group.

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
creation_type
    Choices:
  • AutoCreated
  • Attached ←
ECS instance creation type. Valid when state='absent', instance_ids=None. 'AutoCreated' for the ECS instance is automatically created by the Auto Scaling service in the scaling group. 'Attached' for the ECS instance is created outside the Auto Scaling service and manually attached to the scaling group.

aliases: type
group_id
required
The ID of a scaling group.
instance_ids
ID list of an ECS instance. At most 20 ECS instance supported. Required when state='present'.
state
    Choices:
  • present ←
  • absent
present to add ECS instances; absent to remove ECS instances.

Notes

Note

  • If both instance_ids and creation_type are not specified, the module will remove all of ECS instnaces in the specified Scaling Group when state=absent.
  • 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 instance
- 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
    instance_ids:
      - "i-2ze2y4x26l66h4b4u884"
      - "i-2ze0eyu760pkh468uwg7"
    group_id: asg-2zebnrbt206pex

  tasks:
    - name: add instances to specified
      alicloud_ess_instance:
        alicloud_region: '{{ alicloud_region }}'
        instance_ids: '{{ instance_ids }}'
        group_id: '{{ group_id }}'

    - name: remove auto-created instances
      alicloud_ess_instance:
        alicloud_region: '{{ alicloud_region }}'
        creation_type: 'AutoCreated'
        group_id: '{{ group_id }}'
        state: absent

    - name: remove all of ECS instances
      alicloud_ess_instance:
        alicloud_region: '{{ alicloud_region }}'
        group_id: '{{ group_id }}'
        state: absent

Return Values

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

Key Returned Description
changed
bool
when success
The result of adding or removing.

Sample:
True


Status

This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.

Author

  • He Guimin (@xiaozhu36)

Hint

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