community.general.hwc_vpc_private_ip module – Creates a resource of VPC/PrivateIP in Huawei Cloud
Note
This module is part of the community.general collection (version 11.4.0).
You might already have this collection installed if you are using the ansible package.
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_private_ip.
New in community.general 0.2.0
Synopsis
VPC private IP management.
Requirements
The below requirements are needed on the host that executes this module.
keystoneauth1 >= 3.6.0
Parameters
Parameter |
Comments |
|---|---|
The name of the Domain to scope to (Identity v3). Currently only domain names are supported, and not domain IDs. |
|
The ID of resource to be managed. |
|
The Identity authentication URL. |
|
Specifies the target IP address. The value can be an available IP address in the subnet. If it is not specified, the system automatically assigns an IP address. Cannot be changed after creating the private IP. |
|
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:
|
|
Specifies the ID of the subnet from which IP addresses are assigned. Cannot be changed after creating the private IP. |
|
The user name to login with. Currently only user names are supported, and not user IDs. |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
Notes
Note
If
idoption is provided, it takes precedence oversubnet_id,ip_addressfor private IP selection.subnet_id,ip_addressare used for private IP selection. If more than one private IP with this options exists, execution is aborted.No parameter support updating. If one of option is changed, the module creates a new resource.
For authentication, you can set identity_endpoint using the
ANSIBLE_HWC_IDENTITY_ENDPOINTenvironment variable.For authentication, you can set user using the
ANSIBLE_HWC_USERenvironment variable.For authentication, you can set password using the
ANSIBLE_HWC_PASSWORDenvironment variable.For authentication, you can set domain using the
ANSIBLE_HWC_DOMAINenvironment variable.For authentication, you can set project using the
ANSIBLE_HWC_PROJECTenvironment variable.For authentication, you can set region using the
ANSIBLE_HWC_REGIONenvironment variable.Environment variables values are only used when the playbook values are not set.
Examples
# create a private IP
- name: Create vpc
hwc_network_vpc:
cidr: "192.168.100.0/24"
name: "ansible_network_vpc_test"
register: vpc
- name: Create subnet
hwc_vpc_subnet:
gateway_ip: "192.168.100.32"
name: "ansible_network_subnet_test"
dhcp_enable: true
vpc_id: "{{ vpc.id }}"
cidr: "192.168.100.0/26"
register: subnet
- name: Create a private IP
community.general.hwc_vpc_private_ip:
subnet_id: "{{ subnet.id }}"
ip_address: "192.168.100.33"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Specifies the target IP address. The value can be an available IP address in the subnet. If it is not specified, the system automatically assigns an IP address. Returned: success |
|
Specifies the ID of the subnet from which IP addresses are assigned. Returned: success |