云计算基础设施平台iaas(openstack)超级详细搭建(十四)安装heat服务

注意:接与上一篇博客内容 进行更新
由于整个开源openstack安装过程过于繁琐,命令太长,太繁琐,于是把整个安装命令写成shell脚本。

脚本数量内容过多,已经推送自我的github源码托管中心了。
这是本篇脚本内容所在的github仓库位置
controller节点
脚本内容介绍

#!/bin/bash
source /etc/xiandian/openrc.sh
source /etc/keystone/admin-openrc.sh
mysql -uroot -p$DB_PASS -e "create database IF NOT EXISTS heat ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY '$HEAT_DBPASS' ;"
mysql -uroot -p$DB_PASS -e "GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY '$HEAT_DBPASS' ;"
yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine -y
openstack user create --domain $DOMAIN_NAME --password $HEAT_PASS heat
openstack role add --project service --user heat admin
openstack service create --name heat --description "Orchestration" orchestration
openstack service create --name heat-cfn --description "Orchestration"  cloudformation
openstack endpoint create --region RegionOne orchestration public http://$HOST_NAME:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration internal http://$HOST_NAME:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration admin http://$HOST_NAME:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne cloudformation public http://$HOST_NAME:8000/v1
openstack endpoint create --region RegionOne cloudformation internal http://$HOST_NAME:8000/v1
openstack endpoint create --region RegionOne cloudformation admin http://$HOST_NAME:8000/v1
openstack domain create --description "Stack projects and users" heat
openstack user create --domain heat  --password $HEAT_PASS heat_domain_admin
openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
openstack role create heat_stack_owner
openstack role add --project demo --user demo heat_stack_owner
openstack role create heat_stack_user
crudini --set /etc/heat/heat.conf database connection mysql+pymysql://heat:$HEAT_DBPASS@$HOST_NAME/heat
crudini --set /etc/heat/heat.conf DEFAULT rpc_backend rabbit
crudini --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_host $HOST_NAME
crudini --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_userid $RABBIT_USER
crudini --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_password  $RABBIT_PASS
crudini --set /etc/heat/heat.conf DEFAULT auth_strategy keystone
crudini --set /etc/heat/heat.conf keystone_authtoken auth_uri  http://$HOST_NAME:5000
crudini --set /etc/heat/heat.conf keystone_authtoken auth_url  http://$HOST_NAME:35357
crudini --set /etc/heat/heat.conf keystone_authtoken memcached_servers  $HOST_NAME:11211
crudini --set /etc/heat/heat.conf keystone_authtoken auth_type  password
crudini --set /etc/heat/heat.conf keystone_authtoken project_domain_name  $DOMAIN_NAME
crudini --set /etc/heat/heat.conf keystone_authtoken user_domain_name $DOMAIN_NAME
crudini --set /etc/heat/heat.conf keystone_authtoken project_name  service
crudini --set /etc/heat/heat.conf keystone_authtoken username  heat
crudini --set /etc/heat/heat.conf keystone_authtoken password  $HEAT_PASS

下面是本篇内容的命令的详细操作过程(脚本中已经包含该篇命令的所有操作,但是建议还是熟悉下整个过程之后再运行脚本)

10 安装Heat编配服务
#Controller节点

10.1通过脚本安装heat服务
10.2-10.8编配服务的操作命令已经编写成shell脚本,通过脚本进行一键安装。如下:
#Controller节点
执行脚本iaas-install-heat.sh进行安装


10.2安装heat编配服务软件包

# yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine –y

10.3创建数据库

# mysql -u root -p
mysql> CREATE DATABASE heat;
mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY '000000';     mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY  '000000';

10.4创建用户

openstack user create --domain default --password 000000 heat
openstack role add --project service --user heat admin
openstack domain create --description "Stack projects and users" heat
openstack user create --domain heat  --password 000000  heat_domain_admin
openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
openstack role create heat_stack_owner
openstack role add --project demo --user demo heat_stack_owner
openstack role create heat_stack_user

10.5创建Endpoint和API端点

openstack service create --name heat --description "Orchestration" orchestration
openstack service create --name heat-cfn --description "Orchestration"  cloudformation 
openstack endpoint create --region RegionOne orchestration public http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration internal http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration admin http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne cloudformation public http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation internal http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation admin http://controller:8000/v1

10.6配置Heat服务

openstack-config --set /etc/heat/heat.conf database connection mysql+pymysql://heat:000000@controller/heat
openstack-config --set /etc/heat/heat.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_host controller
openstack-config --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/heat/heat.conf oslo_messaging_rabbit rabbit_password  000000
openstack-config --set /etc/heat/heat.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_uri  http://controller:5000
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_url  http://controller:35357
openstack-config --set /etc/heat/heat.conf keystone_authtoken memcached_servers  controller:11211
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_type  password
openstack-config --set /etc/heat/heat.conf keystone_authtoken project_domain_name  default
openstack-config --set /etc/heat/heat.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/heat/heat.conf keystone_authtoken project_name  service
openstack-config --set /etc/heat/heat.conf keystone_authtoken username  heat
openstack-config --set /etc/heat/heat.conf keystone_authtoken password  000000
openstack-config --set /etc/heat/heat.conf trustee auth_plugin password
openstack-config --set /etc/heat/heat.conf trustee auth_url http://controller:35357
openstack-config --set /etc/heat/heat.conf trustee username heat
openstack-config --set /etc/heat/heat.conf trustee password 000000
openstack-config --set /etc/heat/heat.conf trustee user_domain_name default
openstack-config --set /etc/heat/heat.conf clients_keystone auth_uri http://controller:35357
openstack-config --set /etc/heat/heat.conf trustee ec2authtoken auth_uri http://controller:5000
openstack-config --set /etc/heat/heat.conf DEFAULT heat_metadata_server_url http://controller:8000
openstack-config --set /etc/heat/heat.conf DEFAULT heat_waitcondition_server_url http://controller:8000/v1/waitcondition
openstack-config --set /etc/heat/heat.conf DEFAULT stack_domain_admin heat_domain_admin
openstack-config --set /etc/heat/heat.conf DEFAULT stack_domain_admin_password 000000
openstack-config --set /etc/heat/heat.conf DEFAULT stack_user_domain_name heat

10.7创建数据库

su -s /bin/sh -c "heat-manage db_sync" heat

10.8启动服务

systemctl enable openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl restart openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service


10.9 nginx模板

nginx模板文件存放在/etc/xiandian/目录下,在使用模板之前需成功安装,ceilometer监控服务以及alarm监控服务。
[root@controller xiandian]# ls
lb-server.yaml  nginx_flat.yaml  nginx.yaml  openrc.sh
[root@controller xiandian]# 


构建一台http服务器,将lb-server.yaml模板文件上传至http服务器中。
(其实我们之前已经构建好了httpd的服务了。所以我们只需要把这几个文件放到httpd服务的指定目录即可。)

[root@controller xiandian]# cd /var/www/html/

Guess you like

Origin blog.csdn.net/qq_28513801/article/details/90170677