-
Notifications
You must be signed in to change notification settings - Fork 2
Home
The Orchestration service can be installed on controller node or a dedicated node. We choose the following configuration:
- node vm4 - Heat API and client
- controller node - Heat database
Commands on the node vm4:
-
Install the Orchestration module:
# apt-get install heat-api heat-api-cfn heat-engine -
In the configuration file, specify the location of the database where the Orchestration service stores data. These examples use a MySQL database with a heat user on the controller node. Replace HEAT_DBPASS with the password for the database user:
Edit /etc/heat/heat.conf and modify the [database] section:
[database] # The SQLAlchemy connection string used to connect to the database connection = mysql://heat:HEAT_DBPASS@controller/heat -
By default, the Ubuntu packages create an SQLite database. Delete the heat.sqlite file that was created in the /var/lib/heat/ directory so that it does not get used by mistake:
# rm /var/lib/heat/heat.sqlite
Commands on the controller node:
-
Use the password that you set previously to log in as root and create a heat database user:
$ mysql -u root -p mysql> CREATE DATABASE heat; mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY 'HEAT_DBPASS'; mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY 'HEAT_DBPASS';
Commands on the node vm4:
-
Create the heat service tables:
# su -s /bin/sh -c "heat-manage db_sync" heat[Note] Note Ignore DeprecationWarning errors.
-
The Ubuntu packages do not correctly set up logging. Edit the /etc/heat/heat.conf file and change the [DEFAULT] section:
[DEFAULT] ... # Print more verbose output (set logging level to INFO instead # of default WARNING level). (boolean value) verbose = True ... # (Optional) The base directory used for relative --log-file # paths (string value) log_dir=/var/log/heat -
Configure the Orchestration Service to use the RabbitMQ message broker. Edit /etc/heat/heat.conf and modify the [DEFAULT] section:
rabbit_host = controller rabbit_password = RABBIT_PASS
Commands on the controller node:
-
Create a heat user that the Orchestration service can use to authenticate with the Identity Service. Use the service tenant and give the user the admin role:
$ keystone user-create --name=heat --pass=HEAT_PASS \ [email protected] $ keystone user-role-add --user=heat --tenant=service --role=admin -
Register the Heat and CloudFormation APIs with the Identity Service so that other OpenStack services can locate these APIs. Register the services and specify the endpoints:
$ keystone service-create --name=heat --type=orchestration --description="Orchestration" $ keystone endpoint-create --service-id=$(keystone service-list | awk '/ orchestration / {print $2}') --publicurl=http://controller:8004/v1/%\(tenant_id\)s --internalurl=http://controller:8004/v1/%\(tenant_id\)s --adminurl=http://controller:8004/v1/%\(tenant_id\)s $ keystone service-create --name=heat-cfn --type=cloudformation --description="Orchestration CloudFormation" $ keystone endpoint-create --service-id=$(keystone service-list | awk '/ cloudformation / {print $2}') --publicurl=http://controller:8000/v1 --internalurl=http://controller:8000/v1 --adminurl=http://controller:8000/v1 -
Create the heat_stack_user role. This role is used as the default role for users created by the Orchestration module. Run the following command to create the heat_stack_user role:
$ keystone role-create --name heat_stack_user
Commands on the controller node:
-
Edit the /etc/heat/heat.conf file to change the [keystone_authtoken] and [ec2authtoken] sections to add credentials to the Orchestration Service:
[keystone_authtoken] auth_host = controller auth_port = 35357 auth_protocol = http auth_uri = http://controller:5000/v2.0 admin_tenant_name = service admin_user = heat admin_password = HEAT_PASS [ec2authtoken] auth_uri = http://controller:5000/v2.0 -
Configure the metadata and waitcondition servers' URLs. Edit the /etc/heat/heat.conf file and modify the following options in the [DEFAULT] section:
[DEFAULT] ... # URL of the Heat metadata server. (string value) heat_metadata_server_url = http://10.0.0.11:8000 # URL of the Heat waitcondition server. (string value) heat_waitcondition_server_url = http://10.0.0.11:8000/v1/waitcondition[Note] Note The example uses the IP address of the controller (10.0.0.11) instead of the controller host name since our example architecture does not include a DNS setup. Make sure that the instances can resolve the controller host name if you choose to use it in the URLs.
-
Restart the service with its new settings:
# service heat-api restart # service heat-api-cfn restart # service heat-engine restart
-
To verify that the Orchestration service is installed and configured correctly, make sure that your credentials are set up correctly in the openrc.sh file. Source the file, as follows:
$ source openrc.shThe Orchestration Module uses templates to describe stacks. To learn about the template languages, see the Template Guide in the Heat developer documentation.
-
Create a test template in the test-stack.template file with the following content:
heat_template_version: 2013-05-23 description: Test Template parameters: ImageID: type: string description: Image use to boot a server NetID: type: string description: Network ID for the server resources: server1: type: OS::Nova::Server properties: name: "Test 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 ] } -
Use the heat stack-create command to create a stack from this template:
$ NET_ID=$(nova net-list | awk '/ <subnet_name> / { print $2 }') $ heat stack-create -f test-stack.template -P "ImageID=cirros-0.3.2-x86_64;NetID=$NET_ID" testStack
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
| 477d96b4-d547-4069-938d-32ee990834af | testStack | CREATE_IN_PROGRESS | 2014-04-06T15:11:01Z |
+--------------------------------------+------------+--------------------+----------------------+
-
Verify that the stack was created successfully with the heat stack-list command:
$ heat stack-list
+--------------------------------------+------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+-----------------+----------------------+
| 477d96b4-d547-4069-938d-32ee990834af | testStack | CREATE_COMPLETE | 2014-04-06T15:11:01Z |
+--------------------------------------+------------+-----------------+----------------------+
-
To create a stack, or template, from an existing file, run the following command:
$ heat stack-create mystack --template-file=/PATH_TO_HEAT_TEMPLATES/vm.template --parameters=image_id=<image_id>;shared_net_id=<subnet_id>;key_name=<keypair_name>"The --parameters values that you specify depend on the parameters that are defined in the template. If a website hosts the template file, you can specify the URL with the --template-url parameter instead of the --template-file parameter. The command returns the following output:
+--------------------------------------+---------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+--------------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | CREATE_IN_PROGRESS | 2014-04-03T23:22:08Z |
+--------------------------------------+---------------+--------------------+----------------------+
-
You can also use the stack-create command to validate a template file without creating a stack from it or use the template-validate commnad. To do so, run the following command:
$ heat template-validate --template-file=/PATH_TO_HEAT_TEMPLATES/vm.template --parameters=image_id=<image_id>;shared_net_id=<subnet_id>;key_name=<keypair_name>"If validation fails, the response returns an error message. Get information about stacks.
-
To explore the state and history of a particular stack, you can run a number of commands. To see which stacks are visible to the current user, run the following command:
$ heat stack-list
+--------------------------------------+---------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+-----------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | CREATE_COMPLETE | 2013-04-03T23:22:08Z |
| 7edc7480-bda5-4e1c-9d5d-f567d3b6a050 | my-otherstack | CREATE_FAILED | 2013-04-03T23:28:20Z |
+--------------------------------------+---------------+-----------------+----------------------+
-
To show the details of a stack, run the following command:
$ heat stack-show mystack -
A stack consists of a collection of resources. To list the resources and their status, run the following command:
$ heat resource-list mystack
+---------------------+--------------------+-----------------+----------------------+
| logical_resource_id | resource_type | resource_status | updated_time |
+---------------------+--------------------+-----------------+----------------------+
| WikiDatabase | AWS::EC2::Instance | CREATE_COMPLETE | 2013-04-03T23:25:56Z |
+---------------------+--------------------+-----------------+----------------------+
-
To show the details for the specified resource in a stack, run the following command:
$ heat resource-show mystack WikiDatabase -
A series of events is generated during the life-cycle of a stack. To display life-cycle events, run:
$ heat event-list mystack
+---------------------+----+------------------------+-----------------+----------------------+
| logical_resource_id | id | resource_status_reason | resource_status | event_time |
+---------------------+----+------------------------+-----------------+----------------------+
| WikiDatabase | 1 | state changed | IN_PROGRESS | 2013-04-03T23:22:09Z |
| WikiDatabase | 2 | state changed | CREATE_COMPLETE | 2013-04-03T23:25:56Z |
+---------------------+----+------------------------+-----------------+----------------------+
-
To show the details for a particular event, run the following command:
$ heat event-show WikiDatabase 1
To update an existing stack from a modified template file, run a command like the following command:
$ heat stack-update mystack --template-file=/PATH_TO_HEAT_TEMPLATES/vm-volume.template --parameters=image_id=<image_id>;shared_net_id=<subnet_id>;key_name=<keypair_name>"
+--------------------------------------+---------------+-----------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+---------------+-----------------+----------------------+
| 4c712026-dcd5-4664-90b8-0915494c1332 | mystack | UPDATE_COMPLETE | 2013-04-03T23:22:08Z |
| 7edc7480-bda5-4e1c-9d5d-f567d3b6a050 | my-otherstack | CREATE_FAILED | 2013-04-03T23:28:20Z |
+--------------------------------------+---------------+-----------------+----------------------+
Some resources are updated in-place, while others are replaced with new resources.