13.1. 创建数据库
mysql -u root -p
create database heat;
grant all privileges on heat.* to'heat'@'kilo' identified by 'heat_dbpass';
grant all privileges on heat.* to'heat'@'localhost' identified by 'heat_dbpass';
grant all privileges on heat.* to'heat'@'%' identified by 'heat_dbpass';
exit
13.2. 生成认证和API endpoint
source admin-openrc.sh
openstack user create --password-promptheat
User Password:
Repeat User Password:
+----------+----------------------------------+
| Field | Value |
+----------+----------------------------------+
| email | None |
| enabled | True |
| id | e28d0f506ecd461bbaa2715cbb163983 |
| name | heat |
| username |heat |
+----------+----------------------------------+
openstack role add --project service --userheat admin
+-------+----------------------------------+
| Field |Value |
+-------+----------------------------------+
| id | 14b826a870464c67900a963d675cc8cb |
| name | admin |
+-------+----------------------------------+
openstack role create heat_stack_owner
+-------+----------------------------------+
| Field |Value |
+-------+----------------------------------+
| id | bdec914be5be4075b1e8d6f399a0eb4d |
| name | heat_stack_owner |
+-------+----------------------------------+
openstack role add --project demo --userdemo heat_stack_owner
+-------+----------------------------------+
| Field |Value |
+-------+----------------------------------+
| id | bdec914be5be4075b1e8d6f399a0eb4d |
| name | heat_stack_owner |
+-------+----------------------------------+
openstack role create heat_stack_user
+-------+----------------------------------+
| Field |Value |
+-------+----------------------------------+
| id | 249b37e83e2340c9b3f39b3206732fda |
| name | heat_stack_user |
+-------+----------------------------------+
openstack service create --name heat--description "Orchestration" orchestration
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description |Orchestration |
| enabled | True |
| id | d15519626c2c454c85fd60700aa0bd8f |
| name | heat |
| type | orchestration |
+-------------+----------------------------------+
openstack service create --name heat-cfn--description "Orchestration" cloudformation
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description |Orchestration |
| enabled | True |
| id | 30dd934f2ad94b92b98b869559745d28 |
| name | heat-cfn |
| type | cloudformation |
+-------------+----------------------------------+
openstack endpoint create --publicurlhttp://kilo:8004/v1/%\(tenant_id\)s --internalurlhttp://kilo:8004/v1/%\(tenant_id\)s --adminurlhttp://kilo:8004/v1/%\(tenant_id\)s --region RegionOne orchestration
+--------------+-----------------------------------+
| Field | Value |
+--------------+-----------------------------------+
| adminurl |http://kilo:8004/v1/%(tenant_id)s |
| id |35477b227e1f4c75ac053b8232bd5b34 |
|internalurl |http://kilo:8004/v1/%(tenant_id)s |
| publicurl | http://kilo:8004/v1/%(tenant_id)s |
| region | RegionOne |
| service_id | d15519626c2c454c85fd60700aa0bd8f |
| service_name |heat |
| service_type |orchestration |
+--------------+-----------------------------------+
openstack endpoint create --publicurlhttp://kilo:8000/v1/%\(tenant_id\)s --internalurlhttp://kilo:8000/v1/%\(tenant_id\)s --adminurlhttp://kilo:8000/v1/%\(tenant_id\)s --region RegionOne cloudformation
+--------------+-----------------------------------+
| Field | Value |
+--------------+-----------------------------------+
| adminurl | http://kilo:8000/v1/%(tenant_id)s |
| id |c7de144bd98f48afa4ae04f09650e25d |
|internalurl |http://kilo:8000/v1/%(tenant_id)s |
| publicurl | http://kilo:8000/v1/%(tenant_id)s |
| region | RegionOne |
| service_id | 30dd934f2ad94b92b98b869559745d28 |
| service_name |heat-cfn |
| service_type |cloudformation |
+--------------+-----------------------------------+
13.3. 安装heat
sudo apt-get install heat-api heat-api-cfnheat-engine python-heatclient
13.4. 配置heat
vim /etc/heat/heat.conf
[DEFAULT]
verbose = True
heat_metadata_server_url = http://kilo:8000
heat_waitcondition_server_url =http://kilo:8000/v1/waitcondition
stack_domain_admin = heat_domain_admin
stack_domain_admin_password =heat_domain_pass
stack_user_domain_name = heat_user_domain
rpc_backend = rabbit
[oslo_messaging_rabbit]
rabbit_host = kilo
rabbit_userid = openstack_rabbit_user
rabbit_password = openstack_rabbit_password
[database]
connection =mysql://heat:heat_dbpass@kilo/heat
[keystone_authtoken]
auth_uri = http://kilo:5000/v2.0
identity_uri = http://kilo:35357
admin_tenant_name = service
admin_user = heat
admin_password = heat_pass
13.5. heat-keystone-setup-domain
https://github.com/openstack/heat/blob/stable/kilo/bin/heat-keystone-setup-domain
chmod +x heat-keystone-setup-domain
mv heat-keystone-setup-domain /usr/bin/
source admin-openrc.sh
heat-keystone-setup-domain--stack-user-domain-name heat_user_domain --stack-domain-adminheat_domain_admin --stack-domain-admin-password heat_domain_pass
Please updateyour heat.conf with the following in [DEFAULT]
stack_user_domain_id=c94bbc19a1824ea096ccd899cea4cf5b
stack_domain_admin=heat_domain_admin
stack_domain_admin_password=heat_domain_pass
13.6. 生成heat数据库
sudo bash -c "heat-managedb_sync" heat
13.7. 重启服务
rm -f /var/lib/heat/heat.sqlite
sudo service heat-api restart
sudo serivce heat-api-cfn restart
sudo service heat-engine restart
13.8. 验证安装
source admin-openrc.sh
vim test-stack.yml
heat_template_version:2014-10-16
description: Asimple server.
parameters:
ImageID:
type: string
description: Image use to boot a server
NetID:
type: string
description: Network ID for the server
resources:
server:
type: OS::Nova::Server
properties:
image: { get_param: ImageID }
flavor: m1.tiny
networks:
- network: { get_param: NetID }
outputs:
private_ip:
description: IP address of the server inthe private network
value: { get_attr: [ server, first_address] }
NET_ID=$(nova net-list | awk '/ demo-net /{ print $2 }')
heat stack-create -f test-stack.yml -P"ImageID=cirros-0.3.3-x86_64;NetID=$NET_ID" testStack
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name| stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
|19ff0a49-2c7b-4238-9c58-00e5c3060340 | testStack | CREATE_IN_PROGRESS | 2015-05-27T08:57:02Z |
+--------------------------------------+------------+--------------------+----------------------+
heat stack-list
+--------------------------------------+------------+-----------------+----------------------+
| id | stack_name| stack_status | creation_time |
+--------------------------------------+------------+-----------------+----------------------+
|19ff0a49-2c7b-4238-9c58-00e5c3060340 | testStack | CREATE_COMPLETE | 2015-05-27T08:57:02Z |
+--------------------------------------+------------+-----------------+----------------------+