After completing this section, you should be able to describe a 3-tier web application, as defined in the stack template used to launch the application.
Orchestration automates provisioning of cloud resources, including virtual networks, storage, and servers. It gives domain operators an easy way to create and manage cloud resources in an orderly and predictable fashion. The Orchestration service (Heat) provides OpenStack with orchestration functionality. Orchestration facilitates service deployment by providing a unified interface that can parse text-based instructions. These templates specify the resources to spawn in the cloud, such as compute instances or volumes. The orchestration stack can be composed of a single template or multiple nested templates.
The orchestration service can also execute Heat Orchestration Template (HOT) files written in YAML.
When using either the Dashboard or command line to provision a stack using HOT files, the restful API's are used.
The Heat engine can also validate a template for a stack before deploying it, and this will verify things like syntax or semantics, and ensure there are no circular dependencies.
The Orchestration service can automatically scale-out infrastructure or resources in response to specific situations, such as alarm, threshold, application signal, or the telemetry service.
The deployment of the 3-tier web application using HOT files can be done through the OpenStack Dashboard and command line. Each case is shown below.
To create a stack from a template, use the openstack stack create command. The --parameter option is used to pass various input parameters required by the template. The option can be used multiple times to pass multiple launch parameters. The --template option specifies the path of the template file.
[user@demo ~(user-demo)]$openstack stack create \>--parameter "instance_name=first-instance" \>--template demo-template.yaml \>demo-stack+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id |b1661275-25e2-49f1-b253-c4865168c3b1| | stack_name | demo-stack | | description | My HOT template. | | | | | creation_time | 2020-08-23T04:52:05Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+
To explore the state of the stack and to list the stacks accessible to the user, use the openstack stack list -f json command.
[user@demo ~(user-demo)]$openstack stack list -f json[ { "ID": "b1661275webstack-25e2-49f1-b253-c4865168c3b1", "Stack Name": "demo-stack", "Stack Status": "CREATE_COMPLETE", "Creation Time": "2020-08-23T04:52:05Z", "Updated Time": null } ]
To view information about a stack, use the openstack stack show command. The stack deploys various resources. To list these resources and their status, run the STACK-NAMEopenstack stack resource list command.STACK-NAME
[user@demo ~(user-demo)]$ openstack stack resource list demo-stack -f json
[
{
"resource_name": "server_port",
"physical_resource_id": "3d615dce-4c52-4496-9109-abd2e96e7938",
"resource_type": "OS::Neutron::Port",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2020-08-23T04:52:05Z"
},
{
"resource_name": "server",
"physical_resource_id": "3dd96b3d-0a02-4d8d-84cb-89d309530fbf",
"resource_type": "OS::Nova::Server",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2020-08-23T04:52:05Z"
},
{
"resource_name": "server_floating_ip",
"physical_resource_id": "9547dd01-a441-47ad-87b0-8b89f597de6f",
"resource_type": "OS::Neutron::FloatingIP",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2020-08-23T04:52:05Z"
},
{
"resource_name": "server_security_group",
"physical_resource_id": "9bded7df-0ae8-43a7-aed5-c47e4a9c7c01",
"resource_type": "OS::Neutron::SecurityGroup",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2020-08-23T04:52:05Z"
}
]To view details of a particular resource created by the stack, run openstack stack resource show .STACK-NAME RESOURCE-NAME
[user@demo ~(user-demo)]$ openstack stack resource show demo-stack serverEvents are generated while deploying the stack and during its life cycle. To list the events generated by the stack, use the openstack stack event list command.STACK-NAME
[user@demo ~(user-demo)]$ openstack stack event list demo-stack
020-08-23 04:52:05Z [demo-stack]: CREATE_IN_PROGRESS Stack CREATE started
2020-08-23 04:52:06Z [demo-stack.server_security_group]: CREATE_IN_PROGRESS state changed
2020-08-23 04:52:07Z [demo-stack.server_security_group]: CREATE_COMPLETE state changed
2020-08-23 04:52:07Z [demo-stack.server_port]: CREATE_IN_PROGRESS state changed
2020-08-23 04:52:08Z [demo-stack.server_port]: CREATE_COMPLETE state changed
2020-08-23 04:52:08Z [demo-stack.server_floating_ip]: CREATE_IN_PROGRESS state changed
2020-08-23 04:52:08Z [demo-stack.server]: CREATE_IN_PROGRESS state changed
2020-08-23 04:52:12Z [demo-stack.server_floating_ip]: CREATE_COMPLETE state changed
2020-08-23 04:52:33Z [demo-stack.server]: CREATE_COMPLETE state changed
2020-08-23 04:52:33Z [demo-stack]: CREATE_COMPLETE Stack CREATE completed successfullyThe CREATE_COMPLETE state indicates that the resource specified in the stack is created. The CREATE_IN_PROGRESS state indicates that the resource creation is still in progress. The CREATE_FAILED state indicates that the provision of the resource failed.
Detailed information about an event can be viewed using the openstack stack event show command.STACK-NAME RESOURCE-NAME EVENT-ID
Because event IDs are not displayed by openstack stack event list, use the heat event-list command to view the event ID.STACK-NAME
List the event IDs using the heat event-list command.
[user@demo ~(user-demo)]$ heat event-list demo-stack
+-----------------------+--------+------------------------+--------------------+
| resource_name | id | resource_status_reason | resource_status |
+-----------------------+--------+------------------------+--------------------+
| demo-stack | a(...) | Stack CREATE started | CREATE_IN_PROGRESS |
| server_security_group | 7(...) | state changed | CREATE_IN_PROGRESS |
| server_security_group | 2(...) | state changed | CREATE_COMPLETE |
| server_port | a(...) | state changed | CREATE_IN_PROGRESS |
| server_port | 0(...) | state changed | CREATE_COMPLETE |
| server_floating_ip | c(...) | state changed | CREATE_IN_PROGRESS |
| server | 7(...) | state changed | CREATE_IN_PROGRESS |
| server_floating_ip | 4(...) | state changed | CREATE_COMPLETE |
| server | e(...) | state changed | CREATE_COMPLETE |
| demo-stack | a(...) | Stack CREATE completed | CREATE_COMPLETE |
| | | successfully | |
+-----------------------+--------+------------------------+--------------------+List the detailed information of a particular event using the openstack stack event show command. Use the event ID returned by the heat event-list command.
[user@demo ~(user-demo)]$ openstack stack event show demo-stack server e7327efa-86a5-4f13-9c9f-ce51ac8ed78e
+------------------------+------------------------------------------------------+
| Field | Value |
+------------------------+------------------------------------------------------+
...output omitted...
| resource_properties | { |
| resource_type | OS::Nova::Server |
| | "key_name": "example-keypair", |
| | "image": "rhel8-web", |
| | "flavor": "default", |
| | "networks": [ |
| | { |
| | "port": "3d615dce-4c52-4496-9109-abd2e96e7938" |
| | } |
| | ], |
| | "user_data": |
| | "#!/bin/bash\n |
| | echo 'cloud-init works' > /root/test.txt\n" |
| | } |
+------------------------+------------------------------------------------------+While updating a stack, some resources are updated by changing their properties. This type of change does not require any downtime. However, there are some resources that are replaced with new resources when the stack is updated. Such an update should be avoided if possible because it requires downtime.
[user@demo ~(user-demo)]$openstack stack update \>--parameter "instance_name=demo-server1" \>--template demo-template.yaml \>demo-stack+---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id |b1661275-25e2-49f1-b253-c4865168c3b1| | stack_name | demo-stack | | description | My HOT template. | | | | | creation_time | 2020-08-23T04:52:05Z | | updated_time | 2020-08-24T11:26:39Z | | stack_status | UPDATE_IN_PROGRESS | | stack_status_reason | Stack UPDATE started | +---------------------+--------------------------------------+
Domain operators can delete a stack using openstack stack delete . All resources associated with the stack are also deleted. The STACK-NAME--yes option can be used to skip the prompt when deleting the stack.
[user@demo ~(user-demo)]$openstack stack delete demo-stackAre you sure you want to delete this stack(s) [y/N]?y
The following steps describe the process for creating OpenStack resources using a Heat template from the Dashboard.
Log in to the Dashboard and from top right menu select the project you wish to deploy to.
Navigate to → , and then click .
Choose the appropriate template source and click .
Enter the name of the stack in the field.
Click .
Select the stack name link to view more details about the stack.
The tab shows various resources that the stack creates. Hovering the mouse over the resource icons in the tab shows the resource type and the resource name.
Click the tab to display the stack parameters, stack status, stack output, and launch parameters.
The tab shows the resources created by the stack. Click a resource name or resource ID to display more details about the resource.
The tab shows events that occur during the deployment of the stack, and after it has been deployed.
The tab shows the Heat template used to deploy the stack.
Heat Orchestration Template (HOT) Guide
For more information, refer to the Understanding Heat Templates chapter in the Red Hat OpenStack Platform 16 Advanced Overcloud Customization at https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.0/html-single/advanced_overcloud_customization/index#sect-Understanding_Heat_Templates