Documentation

ali_vpc_facts - Gather facts on vpcs of Alibaba Cloud.

New in version 2.8.

Synopsis

  • This module fetches data from the Open API in Alicloud. The module must be called from within the vpc itself.

Requirements

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

  • footmark >= 1.7.0
  • 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
cidr_prefix
Use a VPC cidr block prefix to filter VPCs.
filters
A dict of filters to apply. Each dict item consists of a filter key and a filter value. The filter keys can be all of request parameters. See https://www.alibabacloud.com/help/doc-detail/35739.htm for parameter details. Filter keys can be same as request parameter name or be lower case and use underscore ("_") or dash ("-") to connect different words in one parameter. 'VpcId' will be appended to vpc_ids automatically.
name_prefix
Use a VPC name prefix to filter VPCs.
vpc_ids
A list of VPC IDs that exist in your account.

aliases: ids
vpc_name
(Deprecated) Name of one or more VPC that exist in your account. New option `name_prefix` instead.

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

# Note: These examples do not set authentication details, see the Alibaba Cloud Guide for details.

# Gather facts about all VPCs
- ali_vpc_facts:

# Gather facts about a particular VPC using VPC ID
- ali_vpc_facts:
    vpc_ids:
      - vpc-aaabbb
      - vpc-123fwec

# Gather facts about any VPC with 'is_default' and name_prefix
- ali_vpc_facts:
    name_prefix: "my-vpc"
    filters:
      is_default: False

# Gather facts about any VPC with cidr_prefix
- ali_vpc_facts:
    cidr_prefix: "172.16"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
ids
list
when success
List all vpc's id after operating vpc.

Sample:
['vpc-2zegusms7jwd94lq7ix8o', 'vpc-2ze5hrb3y5ksx5oa3a0xa']
vpcs
complex
always
Returns an array of complex objects as described below.

  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



Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • He Guimin (@xiaozhu36)

Hint

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