Documentation

alicloud_slb_vsg - Create, Delete VServerGroup and Modify its name or backend servers.

New in version 2.5.

DEPRECATED

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

Synopsis

  • Create, Delete VServerGroup and Modify its name or backend servers.

Requirements

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

  • footmark >= 1.1.16
  • 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
backend_servers
List of backend servers that need to be added.
instance_id
required
The ID of backend server.
port
required
    Choices:
  • 1~65536
Port used to backend server
weight
    Choices:
  • 1~101
Default:
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
    Choices:
  • present ←
  • absent
  • list
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

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 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

Return Values

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}]}}


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)
  • Liu Qiang

Hint

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