New in version 2.5.
| Removed in Ansible: | |
|---|---|
| version: 1.5.0 | |
| Why: | Alibaba Cloud module name prefix “ali” will be more concise. |
| Alternative: | Use ali_slb_vsg instead. |
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 backend servers that need to be added.
|
||
|
instance_id
required |
The ID of backend server.
|
||
|
port
required |
|
Port used to backend server
|
|
| weight |
100
|
The weigth of the backend server
|
|
| load_balancer_id |
The unique ID of an Server Load Balancer instance, It is required when need to create a new vserver group.
|
||
| state |
|
The state of the instance after operating.
|
|
| vserver_group_id |
Virtual server group id. It is required when need to operate an existing vserver group.
aliases: group_id |
||
| vserver_group_name |
Virtual server group name
aliases: group_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# basic provisioning example to create VServer Group in SLB
- name: Create VServer Group in SLB
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
load_balancer_id: <your-specified-load-balancer>
vserver_group_name: test
backend_servers:
- instance_id: <your-specified-ECS-instance-id>
port: 8080
weight: 100
tasks:
- name: Create VServer Group in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
load_balancer_id: '{{ load_balancer_id }}'
vserver_group_name: '{{ vserver_group_name }}'
backend_servers: '{{ backend_servers }}'
state: present
register: result
- debug: var=result
# basic provisioning example to set VServer Group attribute in SLB
- name: set VServer Group attribute in SLB
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
load_balancer_id: <your-specified-load-balancer>
vserver_group_name: test
backend_servers:
- instance_id: <your-specified-ECS-instance-id>
port: 8080
weight: 100
tasks:
- name: Set VServer Group attribute in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
load_balancer_id: '{{ load_balancer_id }}'
vserver_group_name: '{{ vserver_group_name }}'
backend_servers: '{{ backend_servers }}'
state: present
register: result
- debug: var=result
# basic provisioning example to add VServer Group Backend Servers in SLB
- name: Add VServer Group Backend Servers in SLB
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
vserver_group_id: <your-specified-vserver-group-id>
backend_servers:
- instance_id: <your-specified-ECS-instance-id>
port: 8080
weight: 100
tasks:
- name: Add VServer Group Backend Servers in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
vserver_group_id: '{{ vserver_group_id }}'
backend_servers: '{{ backend_servers }}'
state: present
register: result
- debug: var=result
# basic provisioning example to remove VServer Group Backend Servers in SLB
- name: remove VServer Group Backend Servers in SLB
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
vserver_group_id: <your-specified-vserver-group-id>
backend_servers:
- instance_id: <your-specified-ECS-instance-id>
port: 8080
tasks:
- name: remove VServer Group Backend Servers in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
vserver_group_id: '{{ vserver_group_id }}'
backend_servers: '{{ backend_servers }}'
state: absent
register: result
- debug: var=result
# basic provisioning example to describe VServer Group in SLB
- name: describe VServer Group
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
vserver_group_id: <your-specified-vserver-group-id>
tasks:
- name: Describe VServer Group in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
vserver_group_id: '{{ vserver_group_id }}'
state: list
register: result
- debug: var=result
# basic provisioning example to delete VServer Group in SLB
- name: Delete VServer Group
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: ap-southeast-1
vserver_group_id: <your-specified-vserver-group-id>
tasks:
- name: Delete VServer Group in SLB
alicloud_slb_vsg:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
vserver_group_id: '{{ vserver_group_id }}'
state: absent
register: result
- debug: var=result
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
|
vserver_group
dict
|
when success |
The info of vserver_group
Sample:
{'vserver_group_name': 'Group123', 'vserver_group_id': 'rsp-2zejxvoxensk1', 'backend_servers': {'backend_server': [{'server_id': 'i-2ze3ajpeq3y80w4lt4jr', 'port': 80, 'weight': 100}]}}
|
This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.
Hint
If you notice any issues in this documentation you can edit this document to improve it.