Hwceco.Hwcollection

Collection version 1.0.5

Plugin Index

These are the plugins in the hwceco.hwcollection collection

Modules

See also

List of collections with docs hosted here.

hwceco.hwcollection.hwc_cce_cluster – Creates a resource of cce cluster in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_cce_cluster.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of cce cluster in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkcce >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
authenticating_proxy_ca
string
Specifies the CA root certificate provided in the authenticating_proxy mode. The CA root certificate is encoded to the Base64 format.
authentication_mode
string
Default:
"rbac"
Specifies the Authentication mode of the cluster, possible values are x509 and rbac.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
cluster_type
string
Default:
"VirtualMachine"
Specifies the cluster type, possible values are VirtualMachine, BareMetal and ARM64.
cluster_version
string
Specifies the cluster version, defaults to the latest supported version.
container_network_cidr
string
Specifies the container network segment.
container_network_type
string / required
Specifies the container network type.
description
string
Specifies the cluster description.
eip
string
Specifies the EIP address of the cluster.
eni_subnet_cidr
string
Specifies the ENI network segment. Specified when creating a CCE Turbo cluster.
eni_subnet_id
string
Specifies the ENI subnet id. Specified when creating a CCE Turbo cluster.
enterprise_project_id
dictionary
Specifies enterprise project id of the cce cluster.
extend_param
dictionary
Specifies the extended parameter.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
flavor_id
string / required
Specifies the cluster specifications.
cce.s1.small is small-scale single cluster (up to 50 nodes).
cce.s1.medium is medium-scale single cluster (up to 200 nodes).
cce.s1.large is large-scale single cluster (up to 1000 nodes).
cce.s2.small is small-scale HA cluster (up to 50 nodes).
cce.s2.medium is medium-scale HA cluster (up to 200 nodes).
cce.s2.large is large-scale HA cluster (up to 1000 nodes).
cce.t1.small is small-scale single physical machine cluster (up to 10 nodes).
cce.t1.medium is medium-scale single physical machine cluster (up to 100 nodes).
cce.t1.large is large-scale single physical machine cluster (up to 500 nodes).
cce.t2.small is small-scale HA physical machine cluster (up to 10 nodes).
cce.t2.medium is medium-scale HA physical machine cluster (up to 100 nodes).
cce.t2.large is large-scale HA physical machine cluster (up to 500 nodes).
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
kube_proxy_mode
string
Specifies the service forwarding mode.
iptables: Traditional kube-proxy uses iptables rules to implement service load balancing. In this mode, too many iptables rules will be generated when many services are deployed. In addition, non-incremental updates will cause a latency and even obvious performance issues in the case of heavy service traffic.
ipvs: Optimized kube-proxy mode with higher throughput and faster speed. This mode supports incremental updates and can keep connections uninterrupted during service updates. It is suitable for large-sized clusters.
multi_az
boolean
    Choices:
  • no
  • yes
Specifies whether enable multiple AZs for the cluster, only when using HA flavors.
name
string / required
Specifies the name of the cluster.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
service_network_cidr
string
Specifies the service network segment.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
subnet_id
string / required
Specifies the ID of the subnet used to create the node.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"30m"
The timeouts for create operation.
delete
string
Default:
"30m"
The timeouts for delete operation.
vpc_id
string / required
Specifies the ID of the VPC used to create the node.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create an cce cluster
- name: create a vpc
  hwc_vpc:
    cidr: "192.168.100.0/24"
    name: "ansible_vpc_test"
  register: vpc

- name: create a subnet
  hwc_vpc_subnet:
    filters:
      - "name"

    gateway_ip: "192.168.100.32"
    name: "ansible_subnet_test"
    dhcp_enable: true
    vpc_id: "{{ vpc.state.id }}"
    cidr: "192.168.100.0/26"
    # dns is required for cce node installing
    dns_address:
      - "100.125.1.250"
      - "100.125.21.250"
  register: subnet

- name: create a cce cluster
    hwc_cce_cluster:
      filters:
        - "name"

      name: "ansible-cce-cluster-test"
      description: "ansible cce cluster test"
      flavor_id: "cce.s1.small"
      vpc_id: "{{ vpc.state.id }}"
      subnet_id: "{{ subnet.state.id }}"
      container_network_type: "overlay_l2"
      authentication_mode: "rbac"
Return Values

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

Key Returned Description
authenticating_proxy_ca
string
success
Specifies the CA root certificate provided in the authenticating_proxy mode. The CA root certificate is encoded to the Base64 format.

authentication_mode
string
success
Specifies the Authentication mode of the cluster, possible values are x509 and rbac.

cluster_type
string
success
Specifies the cluster type, possible values are VirtualMachine, BareMetal and ARM64.

cluster_version
string
success
Specifies the cluster version, defaults to the latest supported version.

container_network_cidr
string
success
Specifies the container network segment.

container_network_type
string
success
Specifies the container network type.

description
string
success
Specifies the cluster description.

eip
string
success
Specifies the EIP address of the cluster.

eni_subnet_cidr
string
success
Specifies the ENI network segment. Specified when creating a CCE Turbo cluster.

eni_subnet_id
string
success
Specifies the ENI subnet id. Specified when creating a CCE Turbo cluster.

enterprise_project_id
string
success
Specifies enterprise project id of the cce cluster.

extend_param
dictionary
success
Specifies the extended parameter.

flavor_id
string
success
Specifies the cluster specifications.
cce.s1.small is small-scale single cluster (up to 50 nodes).
cce.s1.medium is medium-scale single cluster (up to 200 nodes).
cce.s1.large is large-scale single cluster (up to 1000 nodes).
cce.s2.small is small-scale HA cluster (up to 50 nodes).
cce.s2.medium is medium-scale HA cluster (up to 200 nodes).
cce.s2.large is large-scale HA cluster (up to 1000 nodes).
cce.t1.small is small-scale single physical machine cluster (up to 10 nodes).
cce.t1.medium is medium-scale single physical machine cluster (up to 100 nodes).
cce.t1.large is large-scale single physical machine cluster (up to 500 nodes).
cce.t2.small is small-scale HA physical machine cluster (up to 10 nodes).
cce.t2.medium is medium-scale HA physical machine cluster (up to 100 nodes).
cce.t2.large is large-scale HA physical machine cluster (up to 500 nodes).

kube_proxy_mode
string
success
Specifies the service forwarding mode.
iptables: Traditional kube-proxy uses iptables rules to implement service load balancing. In this mode, too many iptables rules will be generated when many services are deployed. In addition, non-incremental updates will cause a latency and even obvious performance issues in the case of heavy service traffic.
ipvs: Optimized kube-proxy mode with higher throughput and faster speed. This mode supports incremental updates and can keep connections uninterrupted during service updates. It is suitable for large-sized clusters.

multi_az
boolean
success
Specifies whether enable multiple AZs for the cluster, only when using HA flavors.

name
string
success
Specifies the name of the cluster.

service_network_cidr
string
success
Specifies the service network segment.

status
string
success
Specifies the cce cluster status.

subnet_id
string
success
Specifies the ID of the subnet used to create the node.

vpc_id
string
success
Specifies the ID of the VPC used to create the node.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_cce_node – Creates a resource of CCE/Node in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_cce_node.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of CCE/Node in Huawei Cloud

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkcce >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
availability_zone
string / required
Specifies the name of the AZ where the node is located.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
cluster_id
string / required
Specifies the ID of the cluster to which the node belongs.
data_volumes
list / elements=dictionary / required
Specifies the data disks of the node.
size
integer / required
Specifies the system disk size, in GB. The value range is 100 to 32768.
volume_type
string / required
Specifies the disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.
ecs_group_id
string
Specifies the ecs group id. If specified, the node will be created under the cloud server group.
eip_id
string
Specifies the ID of the elastic IP address assigned to the node. Only elastic IP addresses in the DOWN state can be assigned.
extend_param
dictionary
Specifies the extend parameter of the node, key/value pair format.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
fixed_ip
string
Specifies fixed IP of the NIC.
flavor_id
string / required
Specifies the ID of the node flavor.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
k8s_tags
dictionary
Specifies the tags of the kubernetes node, key/value pair format.
key_pair
string
Specifies the key pair name when logging in to select the key pair mode.
max_pods
integer
Specifies the maximum number of instances a node is allowed to create.
name
string
Specifies the node name. Value requirements: Consists of 1 to 64 characters, including letters, digits, hyphens (-), periods (.).
os
string
Specifies the operating System of the node.
password
string
Specifies the root password when logging in to select the password mode.
postinstall
string
Specifies the script required after installation. The input value must be a Base64 encoded.
pretinstall
string
Specifies the script required before installation. The input value must be a Base64 encoded.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
root_volume
dictionary / required
Specifies the system disk of the node.
size
integer / required
Specifies the system disk size, in GB. The value range is 40 to 1024.
volume_type
string / required
Specifies the disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
subnet_id
string
Specifies the ID of the subnet to which the NIC belongs.
tags
dictionary
Specifies the tags of the node, key/value pair format.
taints
list / elements=dictionary
You can add taints to created nodes to configure anti-affinity.
effect
string / required
Available options are NoSchedule, PreferNoSchedule, and NoExecute.
key
string / required
A key must contain 1 to 63 characters starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain name can be used as the prefix of a key.
value
string / required
A value must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"30m"
The timeouts for create operation.
delete
string
Default:
"30m"
The timeouts for delete operation.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create an cce node instance
- name: create a vpc
  hwc_vpc:
    cidr: "192.168.100.0/24"
    name: "ansible_vpc_test"
  register: vpc

- name: create a subnet
  hwc_vpc_subnet:
    gateway_ip: "192.168.100.32"
    name: "ansible_subnet_test"
    dhcp_enable: true
    vpc_id: "{{ vpc.state.id }}"
    cidr: "192.168.100.0/26"
    # dns is required for cce node installing
    dns_address:
      - "100.125.1.250"
      - "100.125.21.250"
    filters:
      - "name"
  register: subnet

- name: create a cce cluster
    hwc_cce_cluster:
      filters:
        - "name"

      name: "ansible-cce-cluster-test"
      description: "ansible cce cluster test"
      flavor_id: "cce.s1.small"
      vpc_id: "{{ vpc.state.id }}"
      subnet_id: "{{ subnet.state.id }}"
      container_network_type: "overlay_l2"
      authentication_mode: "rbac"
    register: cluster

- name: create a cce node
      hwc_cce_node:
        filters:
          - "name"

        name: "ansible-cce-node-test"
        cluster_id: "{{ cluster.state.id }}"
        flavor_id: "s6.large.2"
        availability_zone: "cn-north-4a"
        subnet_id: "{{ subnet.state.id }}"
        key_pair: "test-key-pair"
        root_volume:
          size: 40
          volume_type: "SAS"
        data_volumes:
          - size: 100
            volume_type: "SAS"
Return Values

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

Key Returned Description
availability_zone
string
success
Specifies the name of the AZ where the node is located.

cluster_id
string
success
Specifies the ID of the cluster to which the node belongs.

data_volumes
list / elements=dictionary
success
Specifies the data disks of the node.

 
size
integer
success
Specifies the system disk size, in GB. The value range is 100 to 32768.

 
volume_type
string
success
Specifies the disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.

ecs_group_id
string
success
Specifies the ecs group id. If specified, the node will be created under the cloud server group.

eip_id
string
success
Specifies the ID of the elastic IP address assigned to the node. Only elastic IP addresses in the DOWN state can be assigned.

extend_param
dictionary
success
Specifies the extend parameter of the node, key/value pair format.

fixed_ip
string
success
Specifies fixed IP of the NIC.

flavor_id
string
success
Specifies the ID of the node flavor.

k8s_tags
dictionary
success
Specifies the tags of the kubernetes node, key/value pair format.

key_pair
string
success
Specifies the key pair name when logging in to select the key pair mode.

max_pods
integer
success
Specifies the maximum number of instances a node is allowed to create.

name
string
success
Specifies the node name. Value requirements: Consists of 1 to 64 characters, including letters, digits, hyphens (-), periods (.).

os
string
success
Specifies the operating System of the node.

password
string
success
Specifies the root password when logging in to select the password mode.

postinstall
string
success
Specifies the script required after installation. The input value must be a Base64 encoded.

pretinstall
string
success
Specifies the script required before installation. The input value must be a Base64 encoded.

root_volume
dictionary
success
Specifies the system disk of the node.

 
size
integer
success
Specifies the system disk size, in GB. The value range is 40 to 1024.

 
volume_type
string
success
Specifies the disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.

status
string
success
Specifies the node status.

subnet_id
string
success
Specifies the ID of the subnet to which the NIC belongs.

tags
dictionary
success
Specifies the tags of the node, key/value pair format.

taints
list / elements=dictionary
success
You can add taints to created nodes to configure anti-affinity.

 
effect
integer
success
Available options are NoSchedule, PreferNoSchedule, and NoExecute.

 
key
string
success
A key must contain 1 to 63 characters starting with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain name can be used as the prefix of a key.

 
value
integer
success
A value must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and periods (.).



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_ecs_instance – Creates a resource of Ecs/Instance in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_ecs_instance.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of Ecs/Instance in Huawei Cloud

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkecs >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
admin_pass
string
Specifies the initial login password of the administrator account for logging in to an ECS using password authentication. The Linux administrator is root, and the Windows administrator is Administrator. Password complexity requirements, consists of 8 to 26 characters. The password must contain at least three of the following character types "uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?)". The password cannot contain the username or the username in reverse. The Windows ECS password cannot contain the username, the username in reverse, or more than two consecutive characters in the username.
availability_zone
string / required
Specifies the name of the AZ where the ECS is located.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
data_volumes
list / elements=dictionary
Specifies the data disks of ECS instance.
device
string
Specifies the disk device name.
volume_id
string / required
Specifies the disk ID.
description
string
Specifies the description of an ECS, which is a null string by default. Can contain a maximum of 85 characters. Cannot contain special characters, such as < and >.
eip_id
string
Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be assigned.
enterprise_project_id
string
Specifies the ID of the enterprise project to which the ECS belongs.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
flavor_name
string / required
Specifies the name of the system flavor.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
image_id
string / required
Specifies the ID of the system image.
name
string / required
Specifies the ECS name. Value requirements: Consists of 1 to 64 characters, including letters, digits, underscores _, hyphens (-), periods (.).
nics
list / elements=dictionary / required
Specifies the NIC information of the ECS. Constraints the network of the NIC must belong to the VPC specified by vpc_id. A maximum of 12 NICs can be attached to an ECS.
ip_address
string / required
Specifies the IP address of the NIC. The value is an IPv4 address. Its value must be an unused IP address in the network segment of the subnet.
subnet_id
string / required
Specifies the ID of subnet.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
root_volume
dictionary / required
Specifies the configuration of the ECS's system disks.
size
integer
Specifies the system disk size, in GB. The value range is 1 to 1024. The system disk size must be greater than or equal to the minimum system disk size supported by the image (min_disk attribute of the image). If this parameter is not specified or is set to 0, the default system disk size is the minimum value of the system disk in the image (min_disk attribute of the image).
snapshot_id
string
Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image.
volume_type
string / required
Specifies the ECS system disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.
co-p1 is high I/O (performance-optimized I) disk type.
uh-l1 is ultra-high I/O (latency-optimized) disk type.
NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
security_groups
list / elements=string
Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to the ECS by default.
server_metadata
dictionary
Specifies the metadata of ECS to be created.
server_tags
dictionary
Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags.
ssh_key_name
string
Specifies the name of the SSH key used for logging in to the ECS.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"30m"
The timeouts for create operation.
delete
string
Default:
"30m"
The timeouts for delete operation.
update
string
Default:
"30m"
The timeouts for update operation.
user_data
string
Specifies the user data to be injected during the ECS creation process. Text, text files, and gzip files can be injected. The content to be injected must be encoded with base64. The maximum size of the content to be injected (before encoding) is 32 KB. For Linux ECSs, this parameter does not take effect when adminPass is used. Examples are provided as follows 'Linux #! /bin/bash echo user_test &gt;&gt; /home/user.txt Windows rem cmd echo 111 &gt; c:aa.tx.'
vpc_id
string / required
Specifies the ID of the VPC to which the ECS belongs.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create an ecs instance
- name: create a vpc
  hwc_network_vpc:
    cidr: "192.168.100.0/24"
    name: "ansible_network_vpc_test"
  register: vpc
- name: create a subnet
  hwc_vpc_subnet:
    gateway_ip: "192.168.100.32"
    name: "ansible_network_subnet_test"
    dhcp_enable: true
    vpc_id: "{{ vpc.state.id }}"
    filters:
      - "name"
    cidr: "192.168.100.0/26"
  register: subnet
- name: create a eip
  hwc_vpc_eip:
    dedicated_bandwidth:
      charge_mode: "traffic"
      name: "ansible_test_dedicated_bandwidth"
      size: 1
    type: "5_bgp"
    filters:
      - "type"
      - "dedicated_bandwidth"
  register: eip
- name: create a disk
  hwc_evs_disk:
    filters:
      - "name"
    availability_zone: "cn-north-1a"
    name: "ansible_evs_disk_test"
    volume_type: "SATA"
    size: 10
  register: disk
- name: create an instance
  hwc_ecs_instance:
    data_volumes:
      - volume_id: "{{ disk.state.id }}"
    eip_id: "{{ eip.state.id }}"
    name: "ansible_ecs_instance_test"
    availability_zone: "cn-north-1a"
    nics:
      - subnet_id: "{{ subnet.state.id }}"
        ip_address: "192.168.100.33"
      - subnet_id: "{{ subnet.state.id }}"
        ip_address: "192.168.100.34"
    server_tags:
      my_server: "my_server"
    image_id: "8da46d6d-6079-4e31-ad6d-a7167efff892"
    flavor_name: "s3.small.1"
    filters:
      - "name"
    vpc_id: "{{ vpc.state.id }}"
    root_volume:
      volume_type: "SAS"
Return Values

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

Key Returned Description
admin_pass
string
success
Specifies the initial login password of the administrator account for logging in to an ECS using password authentication. The Linux administrator is root, and the Windows administrator is Administrator. Password complexity requirements consists of 8 to 26 characters. The password must contain at least three of the following character types "uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?)". The password cannot contain the username or the username in reverse. The Windows ECS password cannot contain the username, the username in reverse, or more than two consecutive characters in the username.

availability_zone
string
success
Specifies the name of the AZ where the ECS is located.

config_drive
string
success
Specifies the configuration driver.

created
string
success
Specifies the time when an ECS was created.

data_volumes
list / elements=dictionary
success
Specifies the data disks of ECS instance.

 
device
string
success
Specifies the disk device name.

 
volume_id
string
success
Specifies the disk ID.

description
string
success
Specifies the description of an ECS, which is a null string by default. Can contain a maximum of 85 characters. Cannot contain special characters, such as < and >.

disk_config_type
string
success
Specifies the disk configuration type. MANUAL is The image space is not expanded. AUTO is the image space of the system disk will be expanded to be as same as the flavor.

eip_id
string
success
Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be assigned.

enterprise_project_id
string
success
Specifies the ID of the enterprise project to which the ECS belongs.

flavor_name
string
success
Specifies the name of the system flavor.

host_name
string
success
Specifies the host name of the ECS.

image_id
string
success
Specifies the ID of the system image.

image_name
string
success
Specifies the image name of the ECS.

name
string
success
Specifies the ECS name. Value requirements "Consists of 1 to 64 characters, including letters, digits, underscores _, hyphens (-), periods (.)".

nics
list / elements=dictionary
success
Specifies the NIC information of the ECS. The network of the NIC must belong to the VPC specified by vpc_id. A maximum of 12 NICs can be attached to an ECS.

 
ip_address
string
success
Specifies the IP address of the NIC. The value is an IPv4 address. Its value must be an unused IP address in the network segment of the subnet.

 
port_id
string
success
Specifies the port ID corresponding to the IP address.

 
subnet_id
string
success
Specifies the ID of subnet.

power_state
integer
success
Specifies the power status of the ECS.

root_volume
dictionary
success
Specifies the configuration of the ECS's system disks.

 
device
string
success
Specifies the disk device name.

 
size
integer
success
Specifies the system disk size, in GB. The value range is 1 to 1024. The system disk size must be greater than or equal to the minimum system disk size supported by the image (min_disk attribute of the image). If this parameter is not specified or is set to 0, the default system disk size is the minimum value of the system disk in the image (min_disk attribute of the image).

 
snapshot_id
string
success
Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image.

 
volume_id
string
success
Specifies the disk ID.

 
volume_type
string
success
Specifies the ECS system disk type.
SATA is common I/O disk type.
SAS is high I/O disk type.
SSD is ultra-high I/O disk type.
co-p1 is high I/O (performance-optimized I) disk type.
uh-l1 is ultra-high I/O (latency-optimized) disk type.
NOTE is For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.

security_groups
list / elements=string
success
Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to the ECS by default.

server_alias
string
success
Specifies the ECS alias.

server_metadata
dictionary
success
Specifies the metadata of ECS to be created.

server_tags
dictionary
success
Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags.

ssh_key_name
string
success
Specifies the name of the SSH key used for logging in to the ECS.

status
string
success
Specifies the ECS status. Options are ACTIVE, REBOOT, HARD_REBOOT, REBUILD, MIGRATING, BUILD, SHUTOFF, RESIZE, VERIFY_RESIZE, ERROR, and DELETED.

user_data
string
success
Specifies the user data to be injected during the ECS creation process. Text, text files, and gzip files can be injected. The content to be injected must be encoded with base64. The maximum size of the content to be injected (before encoding) is 32 KB. For Linux ECSs, this parameter does not take effect when adminPass is used. Examples are provided as follows 'Linux #! /bin/bash echo user_test &gt;&gt; /home/user.txt Windows rem cmd echo 111 &gt; c:aa.tx'.

vpc_id
string
success
Specifies the ID of the VPC to which the ECS belongs.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_evs_disk – Creates a resource of Evs/Disk in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_evs_disk.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of Evs/Disk in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkevs >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
availability_zone
string / required
Specifies the AZ where you want to create the disk.
backup_id
string
Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup to create the disk.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
description
string
Specifies the disk description. The value can contain a maximum of 255 bytes.
enable_full_clone
boolean
    Choices:
  • no
  • yes
If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.
enable_scsi
boolean
    Choices:
  • no
  • yes
If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will be VBD, which supports only simple SCSI read/write commands.
NOTE: If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI EVS disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.
enable_share
boolean
    Choices:
  • no
  • yes
Specifies whether the disk is shareable. The default value is False.
encryption_id
string
Specifies the encryption ID. The length of it fixes at 36 bytes.
enterprise_project_id
string
Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified, the disk is bound to the default enterprise project.
filters
string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
image_id
string
Specifies the image ID. If this parameter is specified, the disk is created from an image.
NOTE: BMS system disks cannot be created from BMS images.
name
string / required
Specifies the disk name. The value can contain a maximum of 255 bytes.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
size
string
Specifies the disk size, in GB. Its values are as follows: System disk: 1 GB to 1024 GB, Data disk: 10 GB to 32768 GB. This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size. This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size is equal to the backup size.
snapshot_id
string
Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"30m"
The timeouts for create operation.
delete
string
Default:
"30m"
The timeouts for delete operation.
update
string
Default:
"30m"
The timeouts for update operation.
volume_type
string / required
Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
SSD: specifies the ultra-high I/O disk type.
SAS: specifies the high I/O disk type.
SATA: specifies the common I/O disk type.
NOTE: If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from a snapshot, the volume_type field must be the same as that of the snapshot's source disk.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# test create disk
- name: create a disk
  hwc_evs_disk:
    filters:
      - "name"
    availability_zone: "cn-north-1a"
    name: "ansible_evs_disk_test"
    volume_type: "SATA"
    size: 10
Return Values

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

Key Returned Description
attachments
dictionary
success
Specifies the disk attachment information.

 
attached_at
string
success
Specifies the time when the disk was attached. Time format: UTC YYYY-MM-DDTHH:MM:SS.

 
attachment_id
string
success
Specifies the ID of the attachment information.

 
device
string
success
Specifies the device name.

 
server_id
string
success
Specifies the ID of the server to which the disk is attached.

availability_zone
string
success
Specifies the AZ where you want to create the disk.

backup_id
string
success
Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup to create the disk.

backup_policy_id
string
success
Specifies the backup policy ID.

created_at
string
success
Specifies the time when the disk was created. Time format: UTC YYYY-MM-DDTHH:MM:SS.

description
string
success
Specifies the disk description. The value can contain a maximum of 255 bytes.

enable_full_clone
boolean
success
If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.

enable_scsi
boolean
success
If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will be VBD, which supports only simple SCSI read/write commands.
NOTE: If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI EVS disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.

enable_share
boolean
success
Specifies whether the disk is shareable. The default value is False.

encryption_id
string
success
Specifies the encryption ID. The length of it fixes at 36 bytes.

enterprise_project_id
string
success
Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified, the disk is bound to the default enterprise project.

image_id
string
success
Specifies the image ID. If this parameter is specified, the disk is created from an image. NOTE: BMS system disks cannot be created from BMS images.

is_bootable
boolean
success
Specifies whether the disk is bootable.

is_readonly
boolean
success
Specifies whether the disk is read-only or read/write. True: indicates that the disk is read-only. False: indicates that the disk is read/write.

name
string
success
Specifies the disk name. The value can contain a maximum of 255 bytes.

size
integer
success
Specifies the disk size, in GB. Its values are as follows: System disk: 1 GB to 1024 GB, Data disk: 10 GB to 32768 GB. This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size. This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size is equal to the backup size.

snapshot_id
string
success
Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.

source_volume_id
string
success
Specifies the source disk ID. This parameter has a value if the disk is created from a source disk.

status
string
success
Specifies the disk status.

tags
dictionary
success
Specifies the disk tags.

volume_type
string
success
Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
SSD: specifies the ultra-high I/O disk type.
SAS: specifies the high I/O disk type.
SATA: specifies the common I/O disk type.
NOTE: If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from a snapshot, the volume_type field must be the same as that of the snapshot's source disk.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_vpc – Creates a Huawei Cloud VPC

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_vpc.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a Huawei Cloud VPC.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkvpc >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
cidr
string / required
Specifies the range of available subnets in the vpc.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
description
string
Specifies the description of the vpc.
enterprise_project_id
string
Specifies the enterprise project id of the vpc.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
name
string / required
Specifies the name of vpc.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
tags
dictionary
Specifies the key/value pairs to associate with the vpc.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
- name: create a vpc
  hwc_vpc:
      name: "vpc_1"
      cidr: "192.168.100.0/24"
      state: present
Return Values

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

Key Returned Description
cidr
string
success
the range of available subnets in the vpc.

description
string
success
Specifies the description of the vpc.

enterprise_project_id
string
success
Specifies the enterprise project id of the vpc.

id
string
success
the id of vpc.

name
string
success
the name of vpc.

routes
dictionary
success
the route information.

 
destination
string
success
the destination network segment of a route.

 
next_hop
string
success
the next hop of a route.

status
string
success
the status of vpc.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_vpc_security_group – Creates a resource of Vpc/SecurityGroup in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_vpc_security_group.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of Vpc/SecurityGroup in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkvpc >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
enterprise_project_id
string
Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the security group.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
name
string / required
Specifies the security group name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create a security group
- name: create a security group
  hwc_vpc_security_group:
    name: "ansible_network_security_group_test"
    filters:
      - "name"
Return Values

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

Key Returned Description
description
string
success
Specifies supplementary information about the security group.

enterprise_project_id
string
success
Specifies the enterprise project ID. When creating a security group, associate the enterprise project ID with the security group.

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

rules
dictionary
success
Specifies the security group rule, which ensures that resources in the security group can communicate with one another.

 
description
string
success
Provides supplementary information about the security group rule.

 
direction
string
success
Specifies the direction of access control. The value can be egress or ingress.

 
ethertype
string
success
Specifies the IP protocol version. The value can be IPv4 or IPv6.

 
id
string
success
Specifies the security group rule ID.

 
port_range_max
integer
success
Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be smaller than the port_range_min value. An empty value indicates all ports.

 
port_range_min
integer
success
Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max value. An empty value indicates all ports.

 
protocol
string
success
Specifies the protocol type. The value can be icmp, tcp, udp, or others. If the parameter is left blank, the security group supports all protocols.

 
remote_address_group_id
string
success
Specifies the ID of remote IP address group.

 
remote_group_id
string
success
Specifies the ID of the peer security group.

 
remote_ip_prefix
string
success
Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_vpc_security_group_rule – Creates a resource of Vpc/SecurityGroupRule in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_vpc_security_group_rule.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of Vpc/SecurityGroupRule in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkvpc >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
description
string
Provides supplementary information about the security group rule. The value is a string of no more than 255 characters that can contain letters and digits.
direction
string / required
Specifies the direction of access control. The value can be egress or ingress.
ethertype
string
Specifies the IP protocol version. The value can be IPv4 or IPv6. If you do not set this parameter, IPv4 is used by default.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
port_range_max
integer
Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be smaller than the port_range_min value. An empty value indicates all ports.
port_range_min
integer
Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max value. An empty value indicates all ports.
project_id
string / required
Specifies the of ID of the project to login with.
protocol
string
Specifies the protocol type. The value can be icmp, tcp, or udp. If the parameter is left blank, the security group supports all protocols.
region
string / required
Specifies the Huawei Cloud region.
remote_group_id
string
Specifies the ID of the peer security group. The value is exclusive with parameter remote_ip_prefix.
remote_ip_prefix
string
Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address. The value can be in the CIDR format or IP addresses. The parameter is exclusive with parameter remote_group_id.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
security_group_id
string / required
Specifies the security group rule ID, which uniquely identifies the security group rule.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create a security group rule
- name: create a security group
  hwc_vpc_security_group:
    name: "ansible_network_security_group_test"
    filters:
      - "name"
  register: sg
- name: create a security group rule
  hwc_vpc_security_group_rule:
    direction: "ingress"
    protocol: "tcp"
    ethertype: "IPv4"
    port_range_max: 22
    security_group_id: "{{ sg.state.id }}"
    port_range_min: 22
    filters:
      - "security_group_id"
    remote_ip_prefix: "0.0.0.0/0"
Return Values

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

Key Returned Description
description
string
success
Provides supplementary information about the security group rule. The value is a string of no more than 255 characters that can contain letters and digits.

direction
string
success
Specifies the direction of access control. The value can be egress or ingress.

ethertype
string
success
Specifies the IP protocol version. The value can be IPv4 or IPv6. If you do not set this parameter, IPv4 is used by default.

port_range_max
integer
success
Specifies the end port number. The value ranges from 1 to 65535. If the protocol is not icmp, the value cannot be smaller than the port_range_min value. An empty value indicates all ports.

port_range_min
integer
success
Specifies the start port number. The value ranges from 1 to 65535. The value cannot be greater than the port_range_max value. An empty value indicates all ports.

protocol
string
success
Specifies the protocol type. The value can be icmp, tcp, or udp. If the parameter is left blank, the security group supports all protocols.

remote_group_id
string
success
Specifies the ID of the peer security group. The value is exclusive with parameter remote_ip_prefix.

remote_ip_prefix
string
success
Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address. The value can be in the CIDR format or IP addresses. The parameter is exclusive with parameter remote_group_id.

security_group_id
string
success
Specifies the security group rule ID, which uniquely identifies the security group rule.



Authors
  • Huawei (@huaweicloud)

hwceco.hwcollection.hwc_vpc_subnet – Creates a resource of Vpc/Subnet in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_vpc_subnet.

New in version 1.0.0: of hwceco.hwcollection

Synopsis
  • Creates and manages a resource of Vpc/Subnet in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkvpc >= 3.0.47

Parameters
Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
availability_zone
string
Specifies the AZ to which the subnet belongs.
cidr
string / required
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.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
dhcp_enable
boolean
    Choices:
  • no
  • yes ←
Specifies whether DHCP is enabled for the subnet.
dns_address
list / elements=string
Specifies the DNS server addresses for subnet. The address in the head will be used first.
filters
list / elements=string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
gateway_ip
string / required
Specifies the gateway of the subnet. The value must be an IP address in the subnet.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
ipv6_enable
boolean
    Choices:
  • no ←
  • yes
Specifies whether the IPv6 function is enabled for the subnet.
name
string / required
Specifies the subnet name. The value is a string of 1 to 64 characters that can contain letters, digits, underscores _, hyphens (-), and periods (.).
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
tags
dictionary
Specifies the key/value pairs to associate with the subnet.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"15m"
The timeouts for create operation.
update
string
Default:
"15m"
The timeouts for update operation.
vpc_id
string / required
Specifies the ID of the VPC to which the subnet belongs.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

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

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

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples
# create subnet
- name: create vpc
  hwc_vpc:
      cidr: "192.168.100.0/24"
      name: "ansible_network_vpc_test"
  register: vpc
- name: create subnet
  hwc_vpc_subnet:
      filters:
          - "name"
      vpc_id: "{{ vpc.state.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 Returned Description
availability_zone
string
success
Specifies the AZ to which the subnet belongs.

cidr
string
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.

dhcp_enable
boolean
success
Specifies whether DHCP is enabled for the subnet.

dns_address
list / elements=string
success
Specifies the DNS server addresses for subnet. Note that the address in the head will be used first.

gateway_ip
string
success
Specifies the gateway of the subnet. The value must be an IP address in the subnet.

ipv6_enable
boolean
success
Specifies whether the IPv6 function is enabled for the subnet.

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

tags
dictionary
success
Specifies the key/value pairs to associate with the subnet.

vpc_id
string
success
Specifies the ID of the VPC to which the subnet belongs.



Authors
  • Huawei (@huaweicloud)