lixue323.vpc.ali_vpc_info (1.0.0) — module

Gather facts on vpcs of Alibaba Cloud.

| "added in version" 2.8 of lixue323.vpc"

Authors: He Guimin (@xiaozhu36)

preview | supported by community

Install collection

Install with ansible-galaxy collection install lixue323.vpc:==1.0.0


Add to requirements.yml

  collections:
    - name: lixue323.vpc
      version: 1.0.0

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Note: These examples do not set authentication details, see the Alibaba Cloud Guide for details.

# Gather facts about all VPCs
- ali_vpc_info:
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Gather facts about a particular VPC using VPC ID
- ali_vpc_info:
    vpc_ids:
      - vpc-aaabbb
      - vpc-123fwec
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Gather facts about any VPC with 'is_default' and name_prefix
- ali_vpc_info:
    name_prefix: "my-vpc"
    filters:
      is_default: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Gather facts about any VPC with cidr_prefix
- ali_vpc_info:
    cidr_prefix: "172.16"

Inputs

    
tags:
    description:
    - A hash/dictionaries of vpc tags. C({"key":"value"})

filters:
    description:
    - 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 U(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 I(vpc_ids) automatically.

profile:
    description:
    - This is the Alicloud profile name as set in the shared credentials file. It can
      also be sourced from the ALICLOUD_PROFILE environment variable.
    type: str

vpc_ids:
    aliases:
    - ids
    description:
    - A list of VPC IDs that exist in your account.

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

cidr_prefix:
    description:
    - Use a VPC cidr block prefix to filter VPCs.

name_prefix:
    description:
    - Use a VPC name prefix to filter VPCs.

ecs_role_name:
    aliases:
    - role_name
    description:
    - The RAM Role Name attached on a ECS instance for API operations. You can retrieve
      this from the 'Access Control' section of the Alibaba Cloud console.
    - If you're running Ansible from an ECS instance with RAM Instance using RAM Role,
      Ansible will just access the metadata U(http://100.100.100.200/latest/meta-data/ram/security-credentials/<ecs_role_name>)
      to obtain the STS credential. This is a preferred approach over any other when running
      in ECS as you can avoid hard coding credentials. Instead these are leased on-the-fly
      by Ansible which reduces the chance of leakage.
    type: str

alicloud_region:
    aliases:
    - region
    - region_id
    description:
    - The Alibaba Cloud region to use. If not specified then the value of environment
      variable C(ALICLOUD_REGION), C(ALICLOUD_REGION_ID) will be used instead.
    required: true
    type: str

alicloud_access_key:
    aliases:
    - access_key_id
    - access_key
    description:
    - Alibaba Cloud access key. If not set then the value of environment variable C(ALICLOUD_ACCESS_KEY),
      C(ALICLOUD_ACCESS_KEY_ID) will be used instead.
    type: str

alicloud_secret_key:
    aliases:
    - secret_access_key
    - secret_key
    description:
    - Alibaba Cloud secret key. If not set then the value of environment variable C(ALICLOUD_SECRET_KEY),
      C(ALICLOUD_SECRET_ACCESS_KEY) will be used instead.
    type: str

alicloud_assume_role:
    aliases:
    - assume_role
    description:
    - If provided with a role ARN, Ansible will attempt to assume this role using the
      supplied credentials.
    - The nested assume_role block supports I(alicloud_assume_role_arn), I(alicloud_assume_role_session_name),
      I(alicloud_assume_role_session_expiration) and I(alicloud_assume_role_policy)
    type: dict

alicloud_security_token:
    aliases:
    - security_token
    description:
    - The Alibaba Cloud security token. If not specified then the value of environment
      variable C(ALICLOUD_SECURITY_TOKEN) will be used instead.
    type: str

shared_credentials_file:
    description:
    - This is the path to the shared credentials file. It can also be sourced from the
      ALICLOUD_SHARED_CREDENTIALS_FILE environment variable.
    - If this is not set and a profile is specified,  ~/.aliyun/config.json will be used.
    type: str

alicloud_assume_role_arn:
    aliases:
    - assume_role_arn
    description:
    - The Alibaba Cloud role_arn. The ARN of the role to assume. If ARN is set to an empty
      string, it does not perform role switching. It supports environment variable ALICLOUD_ASSUME_ROLE_ARN.
      ansible will execute with provided credentials.
    type: str

alicloud_assume_role_session_name:
    aliases:
    - assume_role_session_name
    description:
    - The Alibaba Cloud session_name. The session name to use when assuming the role.
      If omitted, 'ansible' is passed to the AssumeRole call as session name. It supports
      environment variable ALICLOUD_ASSUME_ROLE_SESSION_NAME
    type: str

alicloud_assume_role_session_expiration:
    aliases:
    - assume_role_session_expiration
    description:
    - The Alibaba Cloud session_expiration. The time after which the established session
      for assuming role expires. Valid value range 900-3600 seconds. Default to 3600 (in
      this case Alicloud use own default value). It supports environment variable ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION
    type: int

Outputs

ids:
  description: List all vpc's id after operating vpc.
  returned: when success
  sample:
  - vpc-2zegusms7jwd94lq7ix8o
  - vpc-2ze5hrb3y5ksx5oa3a0xa
  type: list
vpcs:
  contains:
    cidr_block:
      description: The CIDR of the VPC
      returned: always
      sample: 10.0.0.0/8
      type: string
    creation_time:
      description: The time the VPC was created.
      returned: always
      sample: '2018-06-24T15:14:45+00:00'
      type: string
    description:
      description: The VPC description.
      returned: always
      sample: my ansible vpc
      type: string
    id:
      description: alias of 'vpc_id'.
      returned: always
      sample: vpc-c2e00da5
      type: string
    is_default:
      description: indicates whether this is the default VPC
      returned: always
      sample: false
      type: bool
    state:
      description: state of the VPC
      returned: always
      sample: available
      type: string
    tags:
      description: tags attached to the VPC, includes name
      returned: always
      sample: null
      type: complex
    user_cidrs:
      description: The custom CIDR of the VPC
      returned: always
      sample: []
      type: list
    vpc_id:
      description: VPC resource id
      returned: always
      sample: vpc-c2e00da5
      type: string
    vpc_name:
      description: Name of the VPC
      returned: always
      sample: my-vpc
      type: string
    vrouter_id:
      description: The ID of virtual router which in the VPC
      returned: always
      sample: available
      type: string
    vswitch_ids:
      description: List IDs of virtual switch which in the VPC
      returned: always
      sample:
      - vsw-123cce3
      - vsw-34cet4v
      type: list
  description: Returns an array of complex objects as described below.
  returned: always
  type: complex