community.general.hwc_vpc_private_ip – Creates a resource of Vpc/PrivateIP in Huawei Cloud

Note

This plugin is part of the community.general collection (version 2.5.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.hwc_vpc_private_ip.

New in version 0.2.0: of community.general

Synopsis

  • vpc private ip management.

Requirements

The below requirements are needed on the host that executes this module.

  • keystoneauth1 >= 3.6.0

Parameters

Parameter Choices/Defaults Comments
domain
string / required
The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs).
id
string
The id of resource to be managed.
identity_endpoint
string / required
The Identity authentication URL.
ip_address
string
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.
password
string / required
The password to login with.
project
string / required
The name of the Tenant (Identity v2) or Project (Identity v3). (currently only project names are supported, and not project IDs).
region
string
The region to which the project belongs.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
subnet_id
string / required
Specifies the ID of the subnet from which IP addresses are assigned. Cannot be changed after creating the private ip.
user
string / required
The user name to login with (currently only user names are supported, and not user IDs).

Notes

Note

  • If id option is provided, it takes precedence over subnet_id, ip_address for private ip selection.

  • subnet_id, ip_address are 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 will create a new resource.

  • For authentication, you can set identity_endpoint using the ANSIBLE_HWC_IDENTITY_ENDPOINT env variable.

  • For authentication, you can set user using the ANSIBLE_HWC_USER env variable.

  • For authentication, you can set password using the ANSIBLE_HWC_PASSWORD env variable.

  • For authentication, you can set domain using the ANSIBLE_HWC_DOMAIN env variable.

  • For authentication, you can set project using the ANSIBLE_HWC_PROJECT env variable.

  • For authentication, you can set region using the ANSIBLE_HWC_REGION env variable.

  • Environment variables values will only be used if 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 Returned Description
ip_address
string
success
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.

subnet_id
string
success
Specifies the ID of the subnet from which IP addresses are assigned.



Authors

  • Huawei Inc. (@huaweicloud)