Documentation

ali_vswitch_facts - Gather facts on vswitchs 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 vswitch 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_block
(Deprecated) The CIDR block representing the Vswitch e.g. 10.0.0.0/8. New option `cidr_prefix` instead.
cidr_prefix
Use a VSwitch cidr block prefix to filter vswitches.
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/35748.htm for parameter details. Filter keys can be same as request parameter name or be lower case and use underscores ("_") or dashes ("-") to connect different words in one parameter. 'VSwitchId' will be appended to vswitch_ids automatically.
name_prefix
Use a VSwitch name prefix to filter vswitches.
vswitch_ids
A list of vswitch IDs to gather facts for.

aliases: subnet_ids, ids
vswitch_name
(Deprecated) Name of one or more vswitch that exist in your account. New option `name_prefix` instead.

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

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

# Gather facts about all VPC vswitches
- ali_vswitch_facts:

# Gather facts about a particular VPC subnet using ID
- ali_vswitch_facts:
    vswitch_ids:
      - vsw-00112233

# Gather facts about any VPC subnet within VPC with ID vpc-abcdef00
- ali_vswitch_facts:
    filters:
      vpc-id: vpc-abcdef00

# Gather facts about a set of VPC subnets, cidrA, cidrB and cidrC within a VPC
- ali_vswitch_facts:
    cidr_prefix: "10.0."
    filters:
      vpc-id: vpc-abcdef00

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 ids of being fetched vswtich.

Sample:
['vsw-2zegusms7jwd94lq7ix8o', 'vsw-2ze5hrb3y5ksx5oa3a0xa']
vswitches
complex
success
Returns an array of complex objects as described below.

  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 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.