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 primary CIDR of the VPC. This is used in conjunction with the
name to ensure idempotence.aliases: cidr |
|
| description |
The description of VPC, which is a string of 2 to 256 characters. It cannot begin with http:// or https://.
|
|
|
multi_ok
bool |
|
By default the module will not create another VPC if there is another VPC with the same name and CIDR block. Specify this as true if you want duplicate VPCs created.
|
|
name
required |
The name to give your VPC, 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://. This is used in combination with
cidr_block to determine if a VPC already exists.aliases: vpc_name |
|
|
recent
bool |
|
By default the module will not choose the recent one if there is another VPC with the same name and cidr_block. Specify this as true if you want to target the recent VPC. There will be conflict when multi_ok=True and recent=True.
|
| state |
|
Whether or not to create, delete VPC.
|
| user_cidrs |
List of user custom cidr in the VPC. It no more than three.
|
|
| vpc_id |
(Deprecated) The ID of a VPC.
|
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 vpc
ali_vpc:
cidr_block: '192.168.0.0/16'
name: 'Demo_VPC'
description: 'Demo VPC'
- name: choose the latest VPC as target when there are several vpcs with same name and cidr block
ali_vpc:
cidr_block: '192.168.0.0/16'
name: 'Demo_VPC'
recent: True
- name: delete a vpc
ali_vpc:
state: absent
cidr_block: '192.168.0.0/16'
name: 'Demo_VPC'
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
|
vpc
complex
|
always |
info about the VPC that was created or deleted
|
|
|
description
string
|
always |
The VPC description.
Sample:
my ansible vpc
|
|
|
tags
complex
|
always |
tags attached to the VPC, includes name
|
|
|
vpc_name
string
|
always |
Name of the VPC
Sample:
my-vpc
|
|
|
creation_time
string
|
always |
The time the VPC was created.
Sample:
2018-06-24 15:14:45
|
|
|
id
string
|
always |
alias of 'vpc_id'.
Sample:
vpc-c2e00da5
|
|
|
is_default
bool
|
always |
indicates whether this is the default VPC
|
|
|
state
string
|
always |
state of the VPC
Sample:
available
|
|
|
vrouter_id
string
|
always |
The ID of virtual router which in the VPC
Sample:
available
|
|
|
vpc_id
string
|
always |
VPC resource id
Sample:
vpc-c2e00da5
|
|
|
vswitch_ids
list
|
always |
List IDs of virtual switch which in the VPC
Sample:
['vsw-123cce3', 'vsw-34cet4v']
|
|
|
cidr_block
string
|
always |
The CIDR of the VPC
Sample:
10.0.0.0/8
|
|
|
user_cidrs
list
|
always |
The custom CIDR of the VPC
|
|
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.