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)