OpenStack Rocky : How to use Heat2018/09/18 |
How to use the OpenStack Orchestration Service (Heat).
This example is based on the emvironment like follows.
------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | L2 Agent | | Libvirt | | Memcached httpd | | L3 Agent | | Nova Compute | | Keystone Glance | | Metadata Agent | | L2 Agent | | Nova API | | Cinder Volume | | | | Neutron Server | | Heat API | | | | Metadata Agent | | Heat Engine | | | | Cinder API | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | Deploy Instances with Heat services and templates. The example below is on the Controle Node. |
heat_template_version: 2018-08-31 description: Heat Sample Template parameters: ImageID: type: string description: Image used to boot a server NetID: type: string description: Network ID for the server resources: server1: type: OS::Nova::Server properties: name: "Heat_Deployed_Server" image: { get_param: ImageID } flavor: "m1.small" networks: - network: { get_param: NetID } outputs: server1_private_ip: description: IP address of the server in the private network value: { get_attr: [ server1, first_address ] }
root@dlp ~(keystone)#
openstack image list +--------------------------------------+------------+--------+ | ID | Name | Status | +--------------------------------------+------------+--------+ | 7df9e97e-96aa-45f9-8ffb-fa8685283a70 | Ubuntu1804 | active | +--------------------------------------+------------+--------+root@dlp ~(keystone)# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 59845493-39f0-44ac-af69-4db727beaeaf | int_net | ee13f5fc-fc2c-4853-beb7-6cb911c69cb4 | | a52a1645-55fb-4600-b42e-67bbdedae320 | ext_net | b81200dc-c6fb-491f-80b6-9176d5b4e48a | +--------------------------------------+---------+--------------------------------------+root@dlp ~(keystone)# Int_Net_ID=$(openstack network list | grep int_net | awk '{ print $2 }')
# create an instance from the template root@dlp ~(keystone)# openstack stack create -t sample-stack.yml --parameter "ImageID=Ubuntu1804;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | d1e7ecd7-51ac-4c38-8bac-1aad34e1d614 | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2018-09-18T03:58:59Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+ # turn to [CREATE_COMPLETE] after few minutes later like follows root@dlp ~(keystone)# openstack stack list +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ | ID | Stack Name | Project | Stack Status | Creation Time | Updated Time | +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ | d1e7ecd7-51ac-4c38-8bac-1aad34e1d614 | Sample-Stack | a4307ece2969492eb795f64da4006b2d | CREATE_COMPLETE | 2018-09-18T03:58:59Z | None | +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ # the instance is running which is created from the Heat template root@dlp ~(keystone)# openstack server list +--------------------------------------+----------------------+--------+------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+----------------------+--------+------------------------+------------+----------+ | 6634e606-9bd8-4da8-9441-47941419c43d | Heat_Deployed_Server | ACTIVE | int_net=192.168.100.13 | Ubuntu1804 | m1.small | +--------------------------------------+----------------------+--------+------------------------+------------+----------+ # delete the instance likwe follows if you don't need root@dlp ~(keystone)# openstack stack delete --yes Sample-Stack root@dlp ~(keystone)# openstack stack list |
[2] |
The guide for writing templates are opened on the official site below.
⇒ https://docs.openstack.org/heat/latest/template_guide/index.html |
Sponsored Link |
|