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
Requirements¶
The below requirements are needed on the host that executes this module.
huaweicloudsdkcore >= 3.0.47
huaweicloudsdkecs >= 3.0.47
Parameters¶
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:
Authors¶
Huawei (@huaweicloud)