OpenStack Epoxy : How to use Heat2025/04/24 |
How to use the OpenStack Orchestration Service (Heat). This example is based on the environment like follows. ------------+--------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ dlp.srv.world ] | | [ network.srv.world ] | | [ node01.srv.world ] | | (Control Node) | | (Network Node) | | (Compute Node) | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached Nginx | | Neutron Server | | Nova Compute | | Keystone httpd | | OVN-Northd | | Open vSwitch | | Glance Nova API | | Nginx iSCSI Target | | OVN Metadata Agent | | Cinder API | | Cinder Volume | | OVN-Controller | | | | Heat API/Engine | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | Deploy Instances with Heat services and templates. The example below is on the Control Node. |
root@dlp ~(keystone)#
apt -y install python3-heatclient heat_template_version: 2021-04-16 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 | +--------------------------------------+------------+--------+ | f1c2157b-e54b-42c2-a09d-885d21b7aa72 | Ubuntu2404 | active | +--------------------------------------+------------+--------+root@dlp ~(keystone)# openstack network list +---------------------------------+---------+----------------------------------+ | ID | Name | Subnets | +---------------------------------+---------+----------------------------------+ | cb803bda-6f08-4ae3-9018- | public | b691b066-62df-45be-a5ee- | | 1c4320ad0295 | | 911e347174ba | | fb4dc320-1981-4914-9d3f- | private | daeaa092-2e5d-44de-9de4- | | f8fd757c4562 | | 51bea52b51b4 | +---------------------------------+---------+----------------------------------+root@dlp ~(keystone)# Int_Net_ID=$(openstack network list | grep private | awk '{ print $2 }')
# create an instance from the template root@dlp ~(keystone)# openstack stack create -t sample-stack.yml --parameter "ImageID=Ubuntu2404;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | 95fe35ed-432a-4a51-9d45-dccc87024032 | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2025-04-24T00:09:22Z | | 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 | +------------+------------+------------+--------------+---------------+--------------+ | 95fe35ed- | Sample- | 5039718bba | CREATE_COMPL | 2025-04- | None | | 432a-4a51- | Stack | 1c4de9bb4b | ETE | 24T00:09:22Z | | | 9d45- | | 792bedfb35 | | | | | dccc870240 | | 8d | | | | | 32 | | | | | | +------------+------------+------------+--------------+---------------+--------------+ # the instance is running which is created from the Heat template root@dlp ~(keystone)# openstack server list +--------------+--------------+--------+---------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+--------------+--------+---------------+------------+----------+ | b28652a6- | Heat_Deploye | ACTIVE | private=192.1 | Ubuntu2404 | m1.small | | 02b0-4dea- | d_Server | | 68.100.89 | | | | 9229- | | | | | | | a9d419527e81 | | | | | | +--------------+--------------+--------+---------------+------------+----------+ # delete the instance 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. |
[3] | If you'd like to use Heat with a common user, it needs to add the user in Heat role. |
root@dlp ~(keystone)# openstack role list +----------------------------------+------------------+ | ID | Name | +----------------------------------+------------------+ | 2eab30f22f1041b2a9100f8e65e31203 | heat_stack_user | | 4898a765b4924548ab73a7408362b6eb | member | | 48f9b7b3cd874d22a51a7a6285b4bdf6 | heat_stack_owner | | 4be72e2028304977a01addde199b0216 | service | | aa3475195eb5419ebcba0c023c3fa5aa | reader | | c3f62e3af4184338815705be77ea7f3e | manager | | e2c3d8dea3f14fff9bb58a800a65b381 | admin | +----------------------------------+------------------+root@dlp ~(keystone)# openstack project list +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | 407400ec8d16434e9badf4ceb9d71f1e | hiroshima | | 5039718bba1c4de9bb4b792bedfb358d | admin | | e5fb0e2eb880471a9101084118997e43 | service | +----------------------------------+-----------+root@dlp ~(keystone)# openstack user list +----------------------------------+-------------------+ | ID | Name | +----------------------------------+-------------------+ | 0eaaa07ec0034105a6b388717d2d3935 | admin | | 3551db3febd34557bc89df9a6766849c | cinder | | 40ee083e4b52431c9fb1ca5ee6a1baf4 | placement | | 419680446d024f768ccdaedfd38d2147 | neutron | | 49ee45264c9241eab69724b11682d72d | glance | | 536c3d2de1414fc6aa585fe84b6b08bf | heat | | 5520f3e2ab4c433095e62534393a8a15 | nova | | 8e902df9df234982ac78764f1d90e5ac | heat_domain_admin | | a30763bf79b944f59efcfd59d4899e5b | serverworld | +----------------------------------+-------------------+ # for example, add [serverworld] user in [hiroshima] project to [heat_stack_owner] role root@dlp ~(keystone)# openstack role add --project hiroshima --user serverworld heat_stack_owner
# that's OK, common users can create stacks ubuntu@dlp ~(keystone)$ openstack stack list +---------------+--------------+---------------+----------------+--------------+ | ID | Stack Name | Stack Status | Creation Time | Updated Time | +---------------+--------------+---------------+----------------+--------------+ | bb992468- | Sample-Stack | CREATE_COMPLE | 2025-04- | None | | 189f-431a- | | TE | 24T00:12:10Z | | | 9bf9- | | | | | | 9a92f9a35d50 | | | | | +---------------+--------------+---------------+----------------+--------------+ubuntu@dlp ~(keystone)$ openstack server list +--------------+--------------+---------+--------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+--------------+---------+--------------+------------+----------+ | 7ef08757- | Heat_Deploye | ACTIVE | private=192. | Ubuntu2404 | m1.small | | 1f1a-4fdc-bb | d_Server | | 168.100.93 | | | | 6b- | | | | | | | fd3d5b13bac2 | | | | | | | fc2ffdc7- | Ubuntu-2404 | SHUTOFF | private=10.0 | Ubuntu2404 | m1.small | | d1e2-4bbf- | | | .0.217, 192. | | | | 9abc- | | | 168.100.107 | | | | 7cbf5e1deb9e | | | | | | +--------------+--------------+---------+--------------+------------+----------+ |
Sponsored Link |