Ansible-使用Ansible在华为云上创建一台ECS实例:创建ECS实例

时间:2023-11-01 16:13:45

创建E CS 实例

结合上面创建的VPC、subnet和磁盘,创建ECS实例。

以下Ansible playbook展示了如何创建一台ECS实例。

- name: create an instance  hwc_ecs_instance:    data_volumes:      - volume_id: "{{ disk.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: "SSD"
support.huaweicloud.com/qs-ansible/ansible_0002.html