community.general.hwc_vpc_subnet module – Creates a resource of Vpc/Subnet in Huawei Cloud
Note
This module is part of the community.general collection (version 9.4.0).
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.hwc_vpc_subnet
.
New in community.general 0.2.0
Synopsis
subnet management.
Requirements
The below requirements are needed on the host that executes this module.
keystoneauth1 >= 3.6.0
Parameters
Parameter |
Comments |
---|---|
Specifies the AZ to which the subnet belongs. Cannot be changed after creating the subnet. |
|
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. |
|
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. Choices:
|
|
Specifies the DNS server addresses for subnet. The address in the head will be used first. |
|
The name of the Domain to scope to (Identity v3). Currently only domain names are supported, and not domain IDs. |
|
Specifies the gateway of the subnet. The value must be an IP address in the subnet. Cannot be changed after creating the subnet. |
|
The ID of resource to be managed. |
|
The Identity authentication URL. |
|
Specifies the subnet name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores ( |
|
The password to login with. |
|
The name of the Tenant (Identity v2) or Project (Identity v3). Currently only project names are supported, and not project IDs. |
|
The region to which the project belongs. |
|
Whether the given object should exist in Huawei Cloud. Choices:
|
|
The timeouts for each operations. Default: |
|
The timeouts for create operation. Default: |
|
The timeouts for update operation. Default: |
|
The user name to login with. Currently only user names are supported, and not user IDs. |
|
Specifies the ID of the VPC to which the subnet belongs. Cannot be changed after creating the subnet. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
For authentication, you can set identity_endpoint using the
ANSIBLE_HWC_IDENTITY_ENDPOINT
environment variable.For authentication, you can set user using the
ANSIBLE_HWC_USER
environment variable.For authentication, you can set password using the
ANSIBLE_HWC_PASSWORD
environment variable.For authentication, you can set domain using the
ANSIBLE_HWC_DOMAIN
environment variable.For authentication, you can set project using the
ANSIBLE_HWC_PROJECT
environment variable.For authentication, you can set region using the
ANSIBLE_HWC_REGION
environment variable.Environment variables values will only be used if the playbook values are not set.
Examples
# create subnet
- name: Create vpc
hwc_network_vpc:
cidr: "192.168.100.0/24"
name: "ansible_network_vpc_test"
register: vpc
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Specifies the AZ to which the subnet belongs. Returned: success |
|
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 |
|
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 |
|
Specifies the DNS server addresses for subnet. The address in the head will be used first. Returned: success |
|
Specifies the gateway of the subnet. The value must be an IP address in the subnet. Returned: success |
|
Specifies the subnet name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores ( Returned: success |
|
Specifies the ID of the VPC to which the subnet belongs. Returned: success |