Note
This plugin is part of the community.general collection (version 3.8.1).
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
.
To use it in a playbook, specify: community.general.hwc_ecs_instance
.
New in version 0.2.0: of community.general
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
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. | ||
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 >. | ||
domain string / required | The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs). | ||
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. | ||
enable_auto_recovery boolean |
| Specifies whether automatic recovery is enabled on the ECS. | |
enterprise_project_id string | Specifies the ID of the enterprise project to which the ECS belongs. | ||
flavor_name string / required | Specifies the name of the system flavor. | ||
id string | The id of resource to be managed. | ||
identity_endpoint string / required | The Identity authentication URL. | ||
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. | ||
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. | ||
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. | ||
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 |
| 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 string / required | The user name to login with (currently only user names are supported, and not user IDs). | ||
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. | ||
vpc_id string / required | Specifies the ID of the VPC to which the ECS belongs. |
Note
ANSIBLE_HWC_IDENTITY_ENDPOINT
env variable.ANSIBLE_HWC_USER
env variable.ANSIBLE_HWC_PASSWORD
env variable.ANSIBLE_HWC_DOMAIN
env variable.ANSIBLE_HWC_PROJECT
env variable.ANSIBLE_HWC_REGION
env variable.# 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.id }}" 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" register: eip - name: Create a disk hwc_evs_disk: availability_zone: "cn-north-1a" name: "ansible_evs_disk_test" volume_type: "SATA" size: 10 register: disk - name: Create an instance community.general.hwc_ecs_instance: data_volumes: - volume_id: "{{ disk.id }}" enable_auto_recovery: false eip_id: "{{ eip.id }}" name: "ansible_ecs_instance_test" availability_zone: "cn-north-1a" nics: - subnet_id: "{{ subnet.id }}" ip_address: "192.168.100.33" - subnet_id: "{{ subnet.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" vpc_id: "{{ vpc.id }}" root_volume: volume_type: "SAS"
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=string | 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. | |
enable_auto_recovery boolean | success | Specifies whether automatic recovery is enabled on the ECS. | |
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=string | 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. | |
vpc_id string | success | Specifies the ID of the VPC to which the ECS belongs. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/hwc_ecs_instance_module.html