openstack heat 实验笔记


root@controller:/home/coa# more 1.yaml
heat_template_version: pike
resources:
new_net:
type: OS::Neutron::Net
properties:
name: soc-test-net.cli
new_subnet:
type: OS::Neutron::Subnet
properties:
name: soc-test-subnet.cli
network_id: {get_resource: new_net}
cidr: "100.8.1.0/24"
dns_nameservers: ["8.8.8.8", "8.8.4.4"]
ip_version: 4

root@controller:/home/coa#

root@controller:/home/coa# openstack stack create --timeout 120 --enable-rollback -t 1.yaml a1
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | ad32dff0-5cc6-4cf4-8b71-162b0b28540b |
| stack_name | a1 |
| description | No description |
| creation_time | 2023-03-31T03:21:32Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+--------------------------------------+
root@controller:/home/coa#
root@controller:/home/coa# openstack stack resource list a1
+---------------+--------------------------------------+---------------------+-----------------+----------------------+
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
+---------------+--------------------------------------+---------------------+-----------------+----------------------+
| new_subnet | 7da948e8-5dbf-449c-8ac1-24effef4771d | OS::Neutron::Subnet | CREATE_COMPLETE | 2023-03-31T03:21:33Z |
| new_net | a227c83b-477f-4b3e-8d1b-3d70c744e199 | OS::Neutron::Net | CREATE_COMPLETE | 2023-03-31T03:21:34Z |
+---------------+--------------------------------------+---------------------+-----------------+----------------------+
root@controller:/home/coa#

 

root@controller:/home/coa# openstack stack create --timeout 120 --enable-rollback -t 2.yaml a2
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | 2309fec1-9a24-4f0b-8f7e-186d83cbb7dd |
| stack_name | a2 |
| description | No description |
| creation_time | 2023-03-31T03:34:15Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+--------------------------------------+
root@controller:/home/coa#

新建虚拟机
root@controller:/home/coa# more 3.yaml
heat_template_version: 2017-09-01
resources:
new_mac:
type: OS::Nova::Server
properties:
name: new_vm2
image: webserver-3.6
flavor: test1.tiny
networks:
- {network: provider1}
root@controller:/home/coa#

root@controller:/home/coa# openstack stack create --timeout 120 --enable-rollback -t 3.yaml a4
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | f67b848d-9ece-48cf-aa3e-89df6b51c41a |
| stack_name | a4 |
| description | No description |
| creation_time | 2023-03-31T03:52:29Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+--------------------------------------+
root@controller:/home/coa# openstack stack resource list a4
+---------------+--------------------------------------+------------------+--------------------+----------------------+
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
+---------------+--------------------------------------+------------------+--------------------+----------------------+
| new_mac | 60c497f6-0f2b-444d-9bd3-8064b8923e58 | OS::Nova::Server | CREATE_IN_PROGRESS | 2023-03-31T03:52:32Z |
+---------------+--------------------------------------+------------------+--------------------+----------------------+
root@controller:/home/coa#


新建网络和虚拟机
root@controller:/home/coa# more 4.yaml
heat_template_version: 2017-09-01
resources:
new_net1:
type: OS::Neutron::Net
properties:
name: new_net1
simple_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: new_net1 }
name: 10_10_10
cidr: 10.10.10.0/24
new_mac:
type: OS::Nova::Server
properties:
name: new_vm4
image: webserver-3.6
flavor: test1.tiny
networks:
- network: {get_resource: new_net1 }
root@controller:/home/coa#

root@controller:/home/coa# openstack stack create --timeout 120 --enable-rollback -t 4.yaml bb4
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| id | 4626ec5e-7c6c-4c82-bb2f-f6bba7a3b292 |
| stack_name | bb4 |
| description | No description |
| creation_time | 2023-03-31T04:09:42Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+--------------------------------------+
root@controller:/home/coa# openstack stack resource list bb4
+---------------+--------------------------------------+---------------------+--------------------+----------------------+
| resource_name | physical_resource_id | resource_type | resource_status | updated_time |
+---------------+--------------------------------------+---------------------+--------------------+----------------------+
| new_net1 | ac4dec90-273b-4876-a66e-dc0520a532ab | OS::Neutron::Net | CREATE_COMPLETE | 2023-03-31T04:09:45Z |
| new_mac | 3b8779b5-b460-462f-80cc-ee4a6fa77669 | OS::Nova::Server | CREATE_IN_PROGRESS | 2023-03-31T04:09:44Z |
| simple_subnet | c13724d6-a8c6-48a3-a5e8-23dd76e59e13 | OS::Neutron::Subnet | CREATE_COMPLETE | 2023-03-31T04:09:45Z |
+---------------+--------------------------------------+---------------------+--------------------+----------------------+
r

posted @ 2023-04-04 08:19  Ratooner  阅读(30)  评论(0编辑  收藏  举报