Documentation

ali_ess_configuration - Create or Terminate an scaling configuration in ESS.

New in version 1.5.0.

Synopsis

  • Scaling configuration defines the configuration of ECS instances used for Auto Scaling. When adding ECS instances to a scaling group, Auto Scaling creates the ECS instances according to the scaling configuration.

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
data_disks
List of hash/dictionaries data disks for scaling ECS instances. A maximum of four items can be entered.
category
    Choices:
  • cloud_efficiency ←
  • cloud_ssd
Category of data disk.
size
Size of data disk, in GB. The valid value range [20, 32768]. Ignored when snapshot_id.
delete_with_instance
bool
    Choices:
  • no
  • yes ←
Whether the data disk will be released along with the instance.
snapshot_id
Snapshot used for creating the data disk.
group_id
ID of the scaling group of a scaling configuration.

aliases: scaling_group_id
id
The ID of existing scaling configuration.

aliases: configuration_id
image_id
Image ID used to scale ECS instances. Required when state=present.

aliases: image
instance_type
Instance type used to scale ECS instances. Required when state=present.

aliases: type
internet_charge_type
    Choices:
  • PayByBandwidth ←
  • PayByTraffic
Internet charge type of scaling ECS instance.
key_name
The name of key pair which is used to access ECS instance in SSH.

aliases: keypair
max_bandwidth_in Default:
200
For scaling ECS instance, maximum incoming bandwidth from the public network, measured in Mbps (Mega bit per second). Valid values range [1,200].
max_bandwidth_out Default:
0
For scaling ECS instance, maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). Valid values range [0,100].
name
The name of scaling configuration. The name must contain 2-40 English or Chinese characters, and start with a number, a letter in upper or lower case or a Chinese character. The name can contain numbers, "_", "-" or ".". Default to configuration Id.

aliases: configuration_name
ram_role_name
The name of the instance RAM role.

aliases: ram_role
security_group_id
Security Group id used to scale ECS instances.
state
    Choices:
  • present ←
  • active
  • inactive
  • absent
The state of the scaling configuration after operating.
system_disk_category
    Choices:
  • cloud_efficiency ←
  • cloud_ssd
Category of the system disk.
system_disk_size
Size of the system disk, in GB. The valid value range [40, 500]. Default to maximum of specified value and image size.
tags
A hash/dictionaries of instance tags, to add to the new instance or for starting/stopping instance by tag. {"key":"value"}
user_data
User-defined data to customize the startup behaviors of an ECS instance and to pass data into an ECS instance. It only will take effect when launching the new ECS instances.

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 configuration
- 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
    image: ubuntu1404_64_40G_cloudinit_20160727.raw
    instance_type: ecs.n4.small
    max_bandwidth_out: 10
    system_disk_category: cloud_efficiency
    system_disk_size: 100
    internet_charge_type: PayByBandwidth
    security_group_id: sg-f2rwnfh23r
    group_id: asg-2zebnrbt206pex
    key_name: key-pair-for-ess
    name: configuration-from-ansible
    data_disks:
      - size: 50
        category: cloud_efficiency
      - snapshot_id: s-w3cif22r2rd
        category: cloud_efficiency
    tags:
      CreatedBy: 'Ansible'
      Version: '1'

  tasks:
    - name: launch scaling configuration
      ali_ess_configuration:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        image: '{{ image }}'
        system_disk_category: '{{ system_disk_category }}'
        system_disk_size: '{{ system_disk_size }}'
        instance_type: '{{ instance_type }}'
        internet_charge_type: '{{ internet_charge_type }}'
        max_bandwidth_out: '{{ max_bandwidth_out }}'
        key_name: '{{ key_name }}'

    - name: launch scaling configuration with data disks and tags
      ali_ess_configuration:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        image: '{{ image }}'
        system_disk_category: '{{ system_disk_category }}'
        system_disk_size: '{{ system_disk_size }}'
        instance_type: '{{ instance_type }}'
        internet_charge_type: '{{ internet_charge_type }}'
        max_bandwidth_out: '{{ max_bandwidth_out }}'
        key_name: '{{ key_name }}'
        data_disks: '{{ data_disks }}'
        tags: '{{ tags }}'

    - name: delete specified scaling configuration
      ali_ess_configuration:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        name: '{{ image }}'
        state: absent

Return Values

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

Key Returned Description
configuration
dict
expect absent
The details of a scaling configuration.

Sample:
{'status': 'inactive', 'name': 'test-for-ansible', 'image_id': 'centos_6_09_64_20G_alibase_20170825.vhd', 'creation_time': '2018-01-05T14:03Z', 'security_group_id': 'sg-2zeb86qfocdo7pvk41tt', 'instance_type': 'ecs.n4.small', 'group_id': 'asg-2zeimuvzeil1xfuor9ej', 'id': 'asc-2zeimuvzeil1ybfd2lt3'}
group_id
str
expect absent
ID of the scaling group of a scaling configuration.

Sample:
asg-2zeimuvzeil1xfuor9ej
id
str
expect absent
Scaling Configuration ID.

Sample:
asc-2zeimuvzeil1ybfd2lt3
name
str
expect absent
Scaling Configuration name.

Sample:
ess-configuration-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.