opentelekomcloud.cloud.as_group module – Create/Update/Remove AutoScaling group from the OTC

Note

This module is part of the opentelekomcloud.cloud collection (version 0.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install opentelekomcloud.cloud.

To use it in a playbook, specify: opentelekomcloud.cloud.as_group.

New in version 0.2.0: of opentelekomcloud.cloud

Synopsis

  • Create/Update/Remove AutoScaling group from the OTC.

Requirements

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

  • openstacksdk

  • openstacksdk >= 0.36.0

  • otcextensions

  • python >= 3.6

Parameters

Parameter

Comments

action

string

Specifies a flag for enabling or disabling an AS group.

Choices:

  • resume

  • pause

api_timeout

integer

How long should the socket layer wait before timing out for API calls. If this is omitted, nothing will be passed to the requests library.

auth

dictionary

Dictionary containing auth information as needed by the cloud’s auth plugin strategy. For the default password plugin, this would contain auth_url, username, password, project_name and any information about domains (for example, os_user_domain_name or os_project_domain_name) if the cloud supports them. For other plugins, this param will need to contain whatever parameters that auth plugin requires. This parameter is not needed if a named cloud is provided or OpenStack OS_* environment variables are present.

auth_type

string

Name of the auth plugin to use. If the cloud uses something other than password authentication, the name of the plugin should be indicated here and the contents of the auth parameter should be updated accordingly.

availability_zones

list / elements=string

Specifies the AZ information. The ECS associated with a scaling action will be created in a specified AZ.If you do not specify an AZ, the system automatically specifies one.

ca_cert

aliases: cacert

string

A path to a CA Cert bundle that can be used as part of verifying SSL API requests.

client_cert

aliases: cert

string

A path to a client certificate to use as part of the SSL transaction.

client_key

aliases: key

string

A path to a client key to use as part of the SSL transaction.

cloud

raw

Named cloud or cloud config to operate against. If cloud is a string, it references a named cloud config as defined in an OpenStack clouds.yaml file. Provides default values for auth and auth_type. This parameter is not needed if auth is provided or if OpenStack OS_* environment variables are present. If cloud is a dict, it contains a complete cloud configuration like would be in a section of clouds.yaml.

cool_down_time

integer

Specifies the cooldown period (in seconds).

The value ranges from 0 to 86400 and is 300 by default.

After a scaling action is triggered, the system starts the cooldown period. During the cooldown period, scaling actions triggered by alarms will be denied. Scheduled, periodic, and manual scaling actions are not affected.

Default: 300

delete_publicip

boolean

Specifies whether to delete the EIP bound to the ECS when deleting the ECS.

The default value is false.

Choices:

  • no ← (default)

  • yes

delete_volume

boolean

Specifies whether to delete the data disks attached to the ECS when deleting the ECS.

The default value is false.

Choices:

  • no ← (default)

  • yes

desire_instance_number

integer

Specifies the expected number of instances.

The default value is the minimum number of instances.

force_delete

boolean

Specifies whether to forcibly delete an AS group, remove the ECS instances and release them when the AS group is running instances or performing scaling actions.

Choices:

  • no ← (default)

  • yes

health_periodic_audit_grace_period

integer

Specifies the grace period for instance health check.

The unit is second and value range is 0-86400.

The default value is 600.

The health check grace period starts after an instance is added to an AS group and is enabled.The AS group will start checking the instance status only after the grace period ends.

This parameter is valid only when the instance health check method of the AS group is ELB_AUDIT.

Default: 600

health_periodic_audit_method

string

Specifies the health check method for instances in the AS group. When load balancing is configured for an AS group, the default value is ELB_AUDIT. Otherwise, the default value is NOVA_AUDIT.

ELB_AUDIT indicates the ELB health check, which takes effect in an AS group with a listener.

NOVA_AUDIT indicates the ECS health check, which is the health check method delivered with AS.

Choices:

  • elb_audit

  • nova_audit

health_periodic_audit_time

integer

Specifies the instance health check period.

The value can be 1, 5, 15, 60, or 180 in the unit of minutes.

If this parameter is not specified, the default value is 5.

If the value is set to 0, health check is performed every 10 seconds.

Default: 5

instance_terminate_policy

string

Specifies the instance removal policy.

OLD_CONFIG_OLD_INSTANCE (default). The earlier-created instances based on the earlier-created AS configurations are removed first.

OLD_CONFIG_NEW_INSTANCE. The later-created instances based on the earlier-created AS configurations are removed first.

OLD_INSTANCE. The earlier-created instances are removed first.

NEW_INSTANCE. The later-created instances are removed first.

Choices:

  • old_config_old_instance ← (default)

  • old_config_new_instance

  • old_instance

  • new_instance

interface

aliases: endpoint_type

string

Endpoint URL type to fetch from the service catalog.

Choices:

  • admin

  • internal

  • public ← (default)

lb_listener

string

Specifies ID or name of a classic load balancer listener. The system supports the binding of up to six load balancer listeners, the IDs of which are separated using a comma (,).

Mandatory when ‘lbaas_listeners’ is not specified.

lbaas_listeners

list / elements=dictionary

Specifies information about an enhanced load balancer.

Mandatory when ‘lb_listener’ is not specified.

pool_id

string / required

Specifies the backend ECS group ID.

protocol_port

integer / required

Specifies the backend protocol ID, which is the port on which a backend ECS listens for traffic. The port ID ranges from 1 to 65535.

weight

integer / required

Specifies the weight, which determines the portion of requests a backend ECS processes when being compared to other backend ECSs added to the same listener.

max_instance_number

integer

Specifies the maximum number of instances.

The default value is 0.

min_instance_number

integer

Specifies the minimum number of instances.

The default value is 0.

multi_az_priority_policy

string

Specifies the priority policy used to select target AZs when adjusting the number of instances in an AS group.

EQUILIBRIUM_DISTRIBUTE (default). When adjusting the number of instances, ensure that instances in each AZ in the available_zones list is evenly distributed. If instances cannot be added in the target AZ, select another AZ based on the PICK_FIRST policy.

PICK_FIRST. When adjusting the number of instances, target AZs are determined in the order in the available_zones list.

Choices:

  • equilibrium_distribute ← (default)

  • pick_first

networks

list / elements=dictionary

Specifies network information. The system supports up to five subnets. The first subnet transferred serves as the primary NIC of the ECS by default.

Mandatory for creation of AS group.

id

string / required

Specifies the network ID.

notifications

list / elements=string

Specifies the notification mode.

region_name

string

Name of the region.

router

string

The router ID or name.

Mandatory for creating AS group.

scaling_configuration

string

The AS configuration ID or name.

scaling_group

dictionary / required

Name or ID of the AS Group.

id

string

Specifies the AS Group ID.

Mandatory for updating and deleting AS Group.

name

string

Specifies the AS Group name.

Mandatory for creating AS Group.

security_groups

list / elements=dictionary

A maximum of one security group can be selected.

Specifies the security group. If the security group is specified both in the AS configuration and AS group, the security group specified in the AS configuration prevails.

If the security group is not specified in either of them, the default security group is used.

id

string / required

Specifies the security group ID.

state

string

Whether resource should be present or absent.

Choices:

  • present ← (default)

  • absent

timeout

integer

The duration in seconds that module should wait.

Default: 200

validate_certs

aliases: verify

boolean

Whether or not SSL API requests should be verified.

Before Ansible 2.3 this defaulted to yes.

Choices:

  • no ← (default)

  • yes

wait

boolean

If the module should wait for the AS Group to be created or deleted.

Choices:

  • no

  • yes ← (default)

Notes

Note

  • The standard OpenStack environment variables, such as OS_USERNAME may be used instead of providing explicit values.

  • Auth information is driven by openstacksdk, which means that values can come from a yaml config file in /etc/ansible/openstack.yaml, /etc/openstack/clouds.yaml or ~/.config/openstack/clouds.yaml, then from standard environment variables, then finally by explicit parameters in plays. More information can be found at https://docs.openstack.org/openstacksdk/

Examples

#Create AS Group
 - opentelekomcloud.cloud.as_group:
     scaling_group:
       name: "as_group_test"
     networks:
       - id: "a64b4561-af18-4440-9976-b2398ed39ce5"
     router: "5d1ac1f4-bec6-4b8c-aae0-7c4345c68f5d"
     scaling_configuration: "as_config_test"
     desire_instance_number: 1
     max_instance_number: 1
     action: "resume"
     state: "present"
     wait: true
     timeout: 360
   register: result

#Delete AS Group
 - opentelekomcloud.cloud.as_group:
     scaling_group:
       name: "as_group_test"
     state: "absent"
     force_delete: true
     wait: true
     timeout: 360
   register: result

Return Values

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

Key

Description

as_group

complex

AS groups object.

Returned: On Success.

id

string

Specifies the AS group ID.

Returned: success

Sample: “39007a7e-ee4f-4d13-8283-b4da2e037c69”

Authors

  • Polina Gubina (@Polina-Gubina)

  • Irina Pereiaslavskaia (@irina-pereiaslavskaia)

Whats next