community.general.hwc_vpc_subnet (8.5.0) — module

Creates a resource of Vpc/Subnet in Huawei Cloud

| "added in version" 0.2.0 of community.general"

Authors: Huawei Inc. (@huaweicloud)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

subnet management.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# create subnet
- name: Create vpc
  hwc_network_vpc:
    cidr: "192.168.100.0/24"
    name: "ansible_network_vpc_test"
  register: vpc
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create subnet
  community.general.hwc_vpc_subnet:
    vpc_id: "{{ vpc.id }}"
    cidr: "192.168.100.0/26"
    gateway_ip: "192.168.100.32"
    name: "ansible_network_subnet_test"
    dhcp_enable: true

Inputs

    
id:
    description:
    - The ID of resource to be managed.
    type: str

cidr:
    description:
    - Specifies the subnet CIDR block. The value must be within the VPC CIDR block and
      be in CIDR format. The subnet mask cannot be greater than 28. Cannot be changed
      after creating the subnet.
    required: true
    type: str

name:
    description:
    - Specifies the subnet name. The value is a string of 1 to 64 characters that can
      contain letters, digits, underscores (V(_)), hyphens (V(-)), and periods (V(.)).
    required: true
    type: str

user:
    description:
    - The user name to login with.
    - Currently only user names are supported, and not user IDs.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether the given object should exist in Huawei Cloud.
    type: str

domain:
    description:
    - The name of the Domain to scope to (Identity v3).
    - Currently only domain names are supported, and not domain IDs.
    required: true
    type: str

region:
    description:
    - The region to which the project belongs.
    type: str

vpc_id:
    description:
    - Specifies the ID of the VPC to which the subnet belongs. Cannot be changed after
      creating the subnet.
    required: true
    type: str

project:
    description:
    - The name of the Tenant (Identity v2) or Project (Identity v3).
    - Currently only project names are supported, and not project IDs.
    required: true
    type: str

password:
    description:
    - The password to login with.
    required: true
    type: str

timeouts:
    default: {}
    description:
    - The timeouts for each operations.
    suboptions:
      create:
        default: 15m
        description:
        - The timeouts for create operation.
        type: str
      update:
        default: 15m
        description:
        - The timeouts for update operation.
        type: str
    type: dict

gateway_ip:
    description:
    - Specifies the gateway of the subnet. The value must be an IP address in the subnet.
      Cannot be changed after creating the subnet.
    required: true
    type: str

dhcp_enable:
    description:
    - Specifies whether DHCP is enabled for the subnet. The value can be true (enabled)
      or false(disabled), and default value is true. If this parameter is set to false,
      newly created ECSs cannot obtain IP addresses, and usernames and passwords cannot
      be injected using Cloud-init.
    required: false
    type: bool

dns_address:
    description:
    - Specifies the DNS server addresses for subnet. The address in the head will be used
      first.
    elements: str
    required: false
    type: list

availability_zone:
    description:
    - Specifies the AZ to which the subnet belongs. Cannot be changed after creating the
      subnet.
    required: false
    type: str

identity_endpoint:
    description:
    - The Identity authentication URL.
    required: true
    type: str

Outputs

availability_zone:
  description:
  - Specifies the AZ to which the subnet belongs.
  returned: success
  type: str
cidr:
  description:
  - Specifies the subnet CIDR block. The value must be within the VPC CIDR block and
    be in CIDR format. The subnet mask cannot be greater than 28.
  returned: success
  type: str
dhcp_enable:
  description:
  - Specifies whether DHCP is enabled for the subnet. The value can be true (enabled)
    or false(disabled), and default value is true. If this parameter is set to false,
    newly created ECSs cannot obtain IP addresses, and usernames and passwords cannot
    be injected using Cloud-init.
  returned: success
  type: bool
dns_address:
  description:
  - Specifies the DNS server addresses for subnet. The address in the head will be
    used first.
  returned: success
  type: list
gateway_ip:
  description:
  - Specifies the gateway of the subnet. The value must be an IP address in the subnet.
  returned: success
  type: str
name:
  description:
  - Specifies the subnet name. The value is a string of 1 to 64 characters that can
    contain letters, digits, underscores (V(_)), hyphens (V(-)), and periods (V(.)).
  returned: success
  type: str
vpc_id:
  description:
  - Specifies the ID of the VPC to which the subnet belongs.
  returned: success
  type: str