community / community.general / 6.6.8 / module / hwc_ecs_instance Creates a resource of Ecs/Instance in Huawei Cloud | "added in version" 0.2.0 of community.general" Authors: Huawei Inc. (@huaweicloud)community.general.hwc_ecs_instance (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
instance management.
# 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"
id: description: - The id of resource to be managed. type: str name: description: - Specifies the ECS name. Value requirements consists of 1 to 64 characters, including letters, digits, underscores C(_), hyphens (-), periods (.). required: true type: str nics: description: - 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. elements: dict required: true suboptions: ip_address: description: - 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. required: true type: str subnet_id: description: - Specifies the ID of subnet. required: true type: str type: list user: description: - The user name to login with (currently only user names are supported, and not user IDs). required: true type: str state: choices: - present - absent default: present description: - Whether the given object should exist in Huawei Cloud. type: str domain: description: - The name of the Domain to scope to (Identity v3). (currently only domain names are supported, and not domain IDs). required: true type: str eip_id: description: - Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be assigned. required: false type: str region: description: - The region to which the project belongs. type: str vpc_id: description: - Specifies the ID of the VPC to which the ECS belongs. required: true type: str project: description: - The name of the Tenant (Identity v2) or Project (Identity v3). (currently only project names are supported, and not project IDs). required: true type: str image_id: description: - Specifies the ID of the system image. required: true type: str password: description: - The password to login with. required: true type: str timeouts: default: {} description: - The timeouts for each operations. suboptions: create: default: 30m description: - The timeouts for create operation. type: str delete: default: 30m description: - The timeouts for delete operation. type: str update: default: 30m description: - The timeouts for update operation. type: str type: dict user_data: description: - 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. required: false type: str admin_pass: description: - 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. required: false type: str description: description: - 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 >. required: false type: str flavor_name: description: - Specifies the name of the system flavor. required: true type: str root_volume: description: - Specifies the configuration of the ECS's system disks. required: true suboptions: size: description: - 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). required: false type: int snapshot_id: description: - Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image. required: false type: str volume_type: description: - 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. required: true type: str type: dict server_tags: description: - Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags. required: false type: dict data_volumes: description: - Specifies the data disks of ECS instance. elements: dict required: false suboptions: device: description: - Specifies the disk device name. required: false type: str volume_id: description: - Specifies the disk ID. required: true type: str type: list ssh_key_name: description: - Specifies the name of the SSH key used for logging in to the ECS. required: false type: str security_groups: description: - Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to the ECS by default. elements: str required: false type: list server_metadata: description: - Specifies the metadata of ECS to be created. required: false type: dict availability_zone: description: - Specifies the name of the AZ where the ECS is located. required: true type: str identity_endpoint: description: - The Identity authentication URL. required: true type: str enable_auto_recovery: description: - Specifies whether automatic recovery is enabled on the ECS. required: false type: bool enterprise_project_id: description: - Specifies the ID of the enterprise project to which the ECS belongs. required: false type: str
admin_pass: description: - 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. returned: success type: str availability_zone: description: - Specifies the name of the AZ where the ECS is located. returned: success type: str config_drive: description: - Specifies the configuration driver. returned: success type: str created: description: - Specifies the time when an ECS was created. returned: success type: str data_volumes: contains: device: description: - Specifies the disk device name. returned: success type: str volume_id: description: - Specifies the disk ID. returned: success type: str description: - Specifies the data disks of ECS instance. returned: success type: list description: description: - 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 >. returned: success type: str disk_config_type: description: - 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. returned: success type: str eip_id: description: - Specifies the ID of the elastic IP address assigned to the ECS. Only elastic IP addresses in the DOWN state can be assigned. returned: success type: str enable_auto_recovery: description: - Specifies whether automatic recovery is enabled on the ECS. returned: success type: bool enterprise_project_id: description: - Specifies the ID of the enterprise project to which the ECS belongs. returned: success type: str flavor_name: description: - Specifies the name of the system flavor. returned: success type: str host_name: description: - Specifies the host name of the ECS. returned: success type: str image_id: description: - Specifies the ID of the system image. returned: success type: str image_name: description: - Specifies the image name of the ECS. returned: success type: str name: description: - Specifies the ECS name. Value requirements "Consists of 1 to 64 characters, including letters, digits, underscores C(_), hyphens (-), periods (.)". returned: success type: str nics: contains: ip_address: description: - 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. returned: success type: str port_id: description: - Specifies the port ID corresponding to the IP address. returned: success type: str subnet_id: description: - Specifies the ID of subnet. returned: success type: str description: - 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. returned: success type: list power_state: description: - Specifies the power status of the ECS. returned: success type: int root_volume: contains: device: description: - Specifies the disk device name. returned: success type: str size: description: - 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). returned: success type: int snapshot_id: description: - Specifies the snapshot ID or ID of the original data disk contained in the full-ECS image. returned: success type: str volume_id: description: - Specifies the disk ID. returned: success type: str volume_type: description: - 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. returned: success type: str description: - Specifies the configuration of the ECS's system disks. returned: success type: dict security_groups: description: - Specifies the security groups of the ECS. If this parameter is left blank, the default security group is bound to the ECS by default. returned: success type: list server_alias: description: - Specifies the ECS alias. returned: success type: str server_metadata: description: - Specifies the metadata of ECS to be created. returned: success type: dict server_tags: description: - Specifies the tags of an ECS. When you create ECSs, one ECS supports up to 10 tags. returned: success type: dict ssh_key_name: description: - Specifies the name of the SSH key used for logging in to the ECS. returned: success type: str status: description: - Specifies the ECS status. Options are ACTIVE, REBOOT, HARD_REBOOT, REBUILD, MIGRATING, BUILD, SHUTOFF, RESIZE, VERIFY_RESIZE, ERROR, and DELETED. returned: success type: str user_data: description: - 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. returned: success type: str vpc_id: description: - Specifies the ID of the VPC to which the ECS belongs. returned: success type: str