Documentation

alicloud_vswitch - Create, Query or Delete Vswitch.

DEPRECATED

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

Synopsis

  • Create, Query or Delete vswitch which in the vpc.

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
alicloud_zone
Aliyun availability zone ID which to launch the vswitch or list vswitches. It is required when creating a vswitch.

aliases: zone_id, zone
cidr_block
The CIDR block representing the Vswitch e.g. 10.0.0.0/8. The value must be sub cidr_block of Vpc. It is required when creating a vswitch.
description
The description of vswitch, which is a string of 2 to 256 characters. It cannot begin with http:// or https://.
is_default
bool
    Choices:
  • no
  • yes
When retrieving VSwitch, it can mark the VSwitch is created by system.
state
    Choices:
  • present ←
  • absent
  • list
Whether or not to create, delete or query vswitch.
vpc_id
The ID of a VPC to which that Vswitch belongs. It is required when creating a vswitch.
vswitch_id
VSwitch ID. It is used to manage the existing VSwitch. Such as modifying VSwitch's attribute or deleting VSwitch.

aliases: subnet_id
vswitch_name
The name of vswitch, which is a string of 2 to 128 Chinese or English characters. It must begin with an uppercase/lowercase letter or a Chinese character and can contain numerals, "_" or "-". It cannot begin with http:// or https://.

aliases: name, subnet_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 vswitch
- name: create vswitch
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-hongkong
    vpc_id: xxxxxxxxxx
    alicloud_zone: cn-hongkong-b
    cidr_block: '172.16.0.0/24'
    name: 'Demo_VSwitch'
    description: 'akashhttp://'
    state: present
  tasks:
    - name: create vswitch
      alicloud_vswitch:
        alicloud_region: '{{ alicloud_region }}'
        cidr_block: '{{ cidr_blok }}'
        name: '{{ name }}'
        description: '{{ description }}'
        vpc_id: '{{ vpc_id }}'
        state: '{{ state }}'
      register: result
    - debug: var=result

# basic provisioning example to delete vswitch
- name: delete vswitch
  hosts: localhost
  connection: local
  vars:
    alicloud_region: cn-hongkong
    vpc_id: xxxxxxxxxx
    vswitch_id: xxxxxxxxxx
    state: absent
  tasks:
    - name: delete vswitch
      alicloud_vswitch:
        alicloud_region: '{{ alicloud_region }}'
        vpc_id: '{{ vpc_id }}'
        vswitch_id: '{{ vswitch_id }}'
        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
vswitch
complex
always
Dictionary of vswitch values

  tags
dict
always
tags attached to the Subnet, includes name

Sample:
{'Name': 'My Subnet', 'env': 'staging'}
  subnet_id
string
always
alias of vswitch_id

Sample:
vsw-b883b2c4
  available_ip_address_count
string
always
number of available IPv4 addresses

Sample:
250
  availability_zone
string
always
Availability zone of the VSwitch

Sample:
cn-beijing-a
  creation_time
string
always
The time the VSwitch was created.

Sample:
2018-06-24 15:14:45
  is_default
bool
always
indicates whether this is the default VSwitch

  vswitch_name
string
always
VSwitch resource name

Sample:
my-vsw
  state
string
always
state of the Subnet

Sample:
available
  vpc_id
string
always
the id of the VPC where this VSwitch exists

Sample:
vpc-67236184
  cidr_block
string
always
The IPv4 CIDR of the VSwitch

Sample:
10.0.0.0/16
  vswitch_id
string
always
VSwitch resource id

Sample:
vsw-b883b2c4
  id
string
always
alias of vswitch_id

Sample:
vsw-b883b2c4


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)

Hint

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