Orchestration
Template creation
Template example:
$ cat demo-template.yml
heat_template_version: 2015-10-15
description: Launch a basic instance with CentOS image
parameters:
NetID:
type: string
description: Network ID to use for the instance.
resources:
server:
type: OS::Nova::Server
properties:
image: CentOS
flavor: bsc.t
key_name: key-user
networks:
- network: { get_param: NetID }
outputs:
instance_name:
description: Name of the instance.
value: { get_attr: [ server, name ] }
instance_ip:
description: IP address of the instance.
value: { get_attr: [ server, first_address ] }
Stack Creation
$ openstack stack create -t demo-template.yml --parameter "NetID=e53ae870-8fd6-4c26-ab65-1161788b26d0" demo-stack
+---------------------+-----------------------------------------------------------------------------------------------------------------+
| Field | Value |
+---------------------+-----------------------------------------------------------------------------------------------------------------+
| stack_name | demo-stack |
| description | Launch a basic instance with CentOS image using the ``bsc.t`` flavor, ``key-user`` key, and net-bsc99 network. |
| creation_time | 2021-10-29T13:21:15Z |
| updated_time | None |
| stack_status | CREATE_IN_PROGRESS |
| stack_status_reason | Stack CREATE started |
+---------------------+-----------------------------------------------------------------------------------------------------------------+
$ openstack stack list
+--------------------------------------+------------+-----------------+----------------------+--------------+
| ID | Stack Name | Stack Status | Creation Time | Updated Time |
+--------------------------------------+------------+-----------------+----------------------+--------------+
| 488f7d41-f538-45bb-b849-e17bd9feaccb | demo-stack | CREATE_COMPLETE | 2021-10-29T13:21:15Z | None |
+--------------------------------------+------------+-----------------+----------------------+--------------+
$ openstack server list
+--------------------------------------+------------------------------------------+---------+---------------------------+--------+---------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+------------------------------------------+---------+---------------------------+--------+---------+
| e2e7c4e1-b7bc-4e1a-b2a4-b44110d114a7 | demo-stack-server-z3fh3d4rmz4x | ACTIVE | net-bsc99=192.168.20.115 | CentOS | bsc.t |
+--------------------------------------+------------------------------------------+---------+---------------------------+--------+---------+