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 |
|
|
cidr_block
required |
The CIDR block representing the Vswitch e.g. 10.0.0.0/8. The value must be sub cidr_block of Vpc. This is used in conjunction with the
vpc_id to ensure idempotence. |
|
| description |
The description of vswitch, which is a string of 2 to 256 characters. It cannot begin with http:// or https://.
|
|
| 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: vswitch_name, subnet_name |
|
| state |
|
Create or delete vswitch.
|
|
vpc_id
required |
The ID of a VPC to which that Vswitch belongs. This is used in combination with
cidr_block to determine if a VSwitch already exists. |
|
| vswitch_id |
(Deprecated) VSwitch ID.
aliases: subnet_id, id |
|
| zone_id |
Aliyun availability zone ID which to launch the vswitch or list vswitches. It is required when creating a new vswitch.
aliases: availability_zone, alicloud_zone |
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 a new vswitch
ali_vswitch:
cidr_block: '{{ cidr_blok }}'
name: 'my-vsw'
vpc_id: 'vpc-abc12345'
- name: modify the existing vswitch
ali_vswitch:
cidr_block: '{{ cidr_blok }}'
vpc_id: 'vpc-abc12345'
name: 'my-vsw-from-ansible'
- name: delete the existing vswitch
ali_vswitch:
cidr_block: '{{ cidr_blok }}'
vpc_id: 'vpc-abc12345'
state: 'absent'
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
|
|
|
zone_id
string
|
always |
Availability zone of the VSwitch
Sample:
cn-beijing-a
|
|
|
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
|
|
|
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
|
|
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.