community.general.hwc_vpc_eip – Creates a resource of Vpc/EIP in Huawei Cloud

Note

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

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

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

New in version 0.2.0: of community.general

Synopsis

  • elastic ip management.

Requirements

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

  • keystoneauth1 >= 3.6.0

Parameters

Parameter Choices/Defaults Comments
dedicated_bandwidth
dictionary
Specifies the dedicated bandwidth object.
charge_mode
string / required
Specifies whether the bandwidth is billed by traffic or by bandwidth size. The value can be bandwidth or traffic. If this parameter is left blank or is null character string, default value bandwidth is used. For IPv6 addresses, the default parameter value is bandwidth outside China and is traffic in China.
name
string / required
Specifies the bandwidth name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).
size
integer / required
Specifies the bandwidth size. The value ranges from 1 Mbit/s to 2000 Mbit/s by default. (The specific range may vary depending on the configuration in each region. You can see the bandwidth range of each region on the management console.) The minimum unit for bandwidth adjustment varies depending on the bandwidth range. The details are as follows.
The minimum unit is 1 Mbit/s if the allowed bandwidth size ranges from 0 to 300 Mbit/s (with 300 Mbit/s included).
The minimum unit is 50 Mbit/s if the allowed bandwidth size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included).
The minimum unit is 500 Mbit/s if the allowed bandwidth size is greater than 1000 Mbit/s.
domain
string / required
The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs).
enterprise_project_id
string
Specifies the enterprise project ID.
id
string
The id of resource to be managed.
identity_endpoint
string / required
The Identity authentication URL.
ip_version
integer
The value can be 4 (IPv4 address) or 6 (IPv6 address). If this parameter is left blank, an IPv4 address will be assigned.
ipv4_address
string
Specifies the obtained IPv4 EIP. The system automatically assigns an EIP if you do not specify it.
password
string / required
The password to login with.
port_id
string
Specifies the port ID. This parameter is returned only when a private IP address is bound with the EIP.
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.
shared_bandwidth_id
string
Specifies the ID of shared bandwidth.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"5m"
The timeouts for create operation.
update
string
Default:
"5m"
The timeouts for update operation.
type
string / required
Specifies the EIP type.
user
string / required
The user name to login with (currently only user names are supported, and not user IDs).

Notes

Note

  • 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 an eip and bind it to a port
- 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 port
  hwc_vpc_port:
    subnet_id: "{{ subnet.id }}"
    ip_address: "192.168.100.33"
  register: port
- name: Create an eip and bind it to a port
  community.general.hwc_vpc_eip:
    type: "5_bgp"
    dedicated_bandwidth:
      charge_mode: "traffic"
      name: "ansible_test_dedicated_bandwidth"
      size: 1
    port_id: "{{ port.id }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
create_time
string
success
Specifies the time (UTC time) when the EIP was assigned.

dedicated_bandwidth
dictionary
success
Specifies the dedicated bandwidth object.

 
charge_mode
string
success
Specifies whether the bandwidth is billed by traffic or by bandwidth size. The value can be bandwidth or traffic. If this parameter is left blank or is null character string, default value bandwidth is used. For IPv6 addresses, the default parameter value is bandwidth outside China and is traffic in China.

 
id
string
success
Specifies the ID of dedicated bandwidth.

 
name
string
success
Specifies the bandwidth name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).

 
size
integer
success
Specifies the bandwidth size. The value ranges from 1 Mbit/s to 2000 Mbit/s by default. (The specific range may vary depending on the configuration in each region. You can see the bandwidth range of each region on the management console.) The minimum unit for bandwidth adjustment varies depending on the bandwidth range. The details are as follows:.
The minimum unit is 1 Mbit/s if the allowed bandwidth size ranges from 0 to 300 Mbit/s (with 300 Mbit/s included).
The minimum unit is 50 Mbit/s if the allowed bandwidth size ranges 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included).
The minimum unit is 500 Mbit/s if the allowed bandwidth size is greater than 1000 Mbit/s.

enterprise_project_id
string
success
Specifies the enterprise project ID.

ip_version
integer
success
The value can be 4 (IPv4 address) or 6 (IPv6 address). If this parameter is left blank, an IPv4 address will be assigned.

ipv4_address
string
success
Specifies the obtained IPv4 EIP. The system automatically assigns an EIP if you do not specify it.

ipv6_address
string
success
Specifies the obtained IPv6 EIP.

port_id
string
success
Specifies the port ID. This parameter is returned only when a private IP address is bound with the EIP.

private_ip_address
string
success
Specifies the private IP address bound with the EIP. This parameter is returned only when a private IP address is bound with the EIP.

shared_bandwidth_id
string
success
Specifies the ID of shared bandwidth.

type
string
success
Specifies the EIP type.



Authors

  • Huawei Inc. (@huaweicloud)