New in version 2.8.
The below requirements are needed on the host that executes this module.
| 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 |
|
| backend_servers |
List of that need to be added or.
List of hash/dictionaries backend servers or network interfaces to add in this group (see example). If none are supplied, no backend servers will be enabled. Each server has several keys and refer to https://www.alibabacloud.com/help/doc-detail/35215.htm. Each key should be format as under_score. Currently the valid keys including "server_id", "port", "weight" and "type".
|
|
|
load_balancer_id
required |
The Server Load Balancer instance ID. This is used in combination with
name to determine if a VServer group already exists.aliases: lb_id |
|
|
multi_ok
bool |
|
By default the module will not create another Load Balancer if there is another Load Balancer with the same name. Specify this as true if you want duplicate Load Balancers created.
|
|
purge_backend_servers
bool |
|
Purge existing backend servers or ENIs on VServer group that are not found in backend_servers.
If True, existing servers or ENIs will be purged from the resource to match exactly what is defined by backend_servers. If the backend_servers is not set then servers will not be modified.
If True, it means you have to specify all the desired backend servers or ENIs on each task affecting a VServer group.
|
| state |
|
Create and delete a VServer group.
|
| vserver_group_id |
(Deprecated) Virtual server group id.
aliases: group_id |
|
|
vserver_group_name
required |
Virtual server group name. This is used in conjunction with the
load_balancer_id to ensure idempotence.aliases: group_name, name |
Note
ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKENALICLOUD_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# Note: These examples do not set authentication details, see the Alibaba Cloud Guide for details.
- name: Create VServer Group in SLB
ali_slb_vsg:
load_balancer_id: 'lb-cnqnc234'
name: 'ansible-vsg'
- name: Add backend servers to vserver group
ali_slb_vsg:
load_balancer_id: 'lb-cnqnc234'
name: 'ansible-vsg'
backend_servers:
- instance_id: 'i-f2n3cn34c'
port: 8080
weight: 100
type: ecs
- instance_id: 'eni-n34cjf4vd'
port: 8081
weight: 100
type: eni
- name: Purge backend servers from vserver group
ali_slb_vsg:
load_balancer_id: 'lb-cnqnc234'
name: 'ansible-vsg'
backend_servers:
- instance_id: 'eni-f2n3cn34c'
port: 8080
weight: 100
type: eni
- instance_id: 'eni-n34cjf4vd'
port: 8081
weight: 100
type: eni
purge_backend_servers: True
- name: Delete VServer Group in SLB
ali_slb_vsg:
load_balancer_id: 'lb-cnqnc234'
name: 'ansible-vsg'
state: absent
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | ||
|---|---|---|---|---|
|
vserver_group
complex
|
on present |
info about the virtual server group that was created or deleted.
|
||
|
name
string
|
always |
The name of the virtual server group was created.
Sample:
ansible-ali_slb_vsg
|
||
|
tags
complex
|
always |
The load balancer tags
|
||
|
vserver_group_name
string
|
always |
The name of the virtual server group was created.
Sample:
ansible-ali_slb_vsg
|
||
|
address
string
|
always |
The IP address of the loal balancer
Sample:
47.94.26.126
|
||
|
vserver_group_id
string
|
always |
The ID of the virtual server group was created.
Sample:
rsp-2zehblhcv
|
||
|
backend_servers
complex
|
always |
The load balancer's backend servers
|
||
|
server_id
string
|
always |
The backend server id
Sample:
i-vqunci342
|
||
|
type
string
|
always |
The backend server type, ecs or eni
Sample:
ecs
|
||
|
port
int
|
always |
The backend server port
Sample:
22
|
||
|
weight
int
|
always |
The backend server weight
Sample:
100
|
||
|
id
string
|
always |
The ID of the virtual server group was created. Same as vserver_group_id.
Sample:
rsp-2zehblhcv
|
||
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.