Documentation

alicloud_slb_lb - Create, Delete, Enable or Disable Server Load Balancer in ECS.

DEPRECATED

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

Synopsis

  • Create, Delete, Enable or Disable Server Load Balancer in ECS.

Requirements

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

  • footmark >= 1.1.18
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
address_type
(deprecated) The field has been deprecated from ansible-alicloud v1.1.3 and 'is_internet' will replace.
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
bandwidth
    Choices:
  • 1-1000 Mbps
Default:
1
Bandwidth peak of the public network instance charged per fixed bandwidth. It will be ignored when internet_charge_type=paybytraffic
internet_charge_type
    Choices:
  • paybybandwidth
  • paybytraffic ←
The charge type of internet. It will be ignored when is_internet=False
is_internet
bool
    Choices:
  • no
  • yes
Default:
Ture
Load balancer network type whether is internet.
load_balancer_id
This parameter is required when user wants to perform edit operation in Load Balancer

aliases: id
load_balancer_name
The name of the server load balancer, which is a string of 1 to 80 characters. It can contain numerals, "_", "/", "." or "-".

aliases: name
load_balancer_status
(deprecated) The field has been deprecated from ansible-alicloud v1.1.3.
master_zone_id
The main usable area ID of the created Load Balancer can be found by the DescribeZone interface
slave_zone_id
The ID of the standby zone of the created Load Balancer can be found on the DescribeZone interface
state
    Choices:
  • present ←
  • absent
  • running
  • stopped
The state of the instance after operating.
vswitch_id
The vswitch id of the VPC instance.

aliases: subnet_id

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 Load Balancer
- name: create server load balancer
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-beijing
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    load_balancer_name: demo_slb
    internet_charge_type: paybytraffic
    state: present
  tasks:
    - name: create server load balancer
      alicloud_slb_lb:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        load_balancer_name: '{{ load_balancer_name }}'
        address_type: '{{ address_type }}'
        internet_charge_type: '{{ internet_charge_type }}'
        state: '{{ state }}'
      register: result
    - debug: var=result

# Basic provisioning example to Modify  SLB Internet Specification
- name: modify server load balancer internet specification
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-beijing
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    load_balancer_id: <your-specified-load-balancer>
    internet_charge_type: paybytraffic
    bandwidth: 5
  tasks:
    - name: modify server load balancer internet specification
      alicloud_slb_lb:
        alicloud_region: '{{ alicloud_region }}'
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        load_balancer_id: '{{ load_balancer_id }}'
        internet_charge_type: '{{ internet_charge_type }}'
        bandwidth: '{{ bandwidth }}'
      register: result
    - debug: var=result

# Basic provisioning example to Delete Server Load Balancer
- name: delete server load balancer
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-beijing
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    load_balancer_id: <your-specified-load-balancer>
    state : absent
  tasks:
    - name: delete server load balancer
      alicloud_slb_lb:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        load_balancer_id: '{{ load_balancer_id }}'
        state: '{{ state }}'
      register: result
    - debug: var=result

# Basic provisioning example to set Server Load Balancer Name
- name: set server load balancer name
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-beijing
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    load_balancer_id: <your-specified-load-balancer>
    load_balancer_name: slb_new_name
    state : present
  tasks:
    - name: set server load balancer name
      alicloud_slb_lb:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        load_balancer_id: '{{ load_balancer_id }}'
        load_balancer_name: '{{ load_balancer_name }}'
        state: '{{ state }}'
      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
load_balancer
string
on present
Describe the current info of load_balancer after user operate a load_balancer

Sample:
{'status': 'active', 'bandwidth': None, 'internet_charge_type': '4', 'name': 'test_change_name', 'address': '101.201.177.136', 'network_type': 'classic', 'id': 'lb-2zekcf2uvij5yw3a7t1c3'}
load_balancer_id
string
on present or absent
Unique identification of load balancing instance

Sample:
lb-2zekcf2uvij5yw3a7t1c3


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.