在控制节点上执行
controller-heat(){
mysql -uroot -p${MYSQL_PASSWD} << EOF
DROP DATABASE IF EXISTS heat;
CREATE DATABASE heat;
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY '${HEAT_PASSWD}';
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY '${HEAT_PASSWD}';
EOF
source ~/admin-openrc
openstack user create --domain default --password ${HEAT_PASSWD} heat
openstack role add --project service --user heat admin
openstack service create --name heat --description "Orchestration" orchestration
openstack endpoint create --region RegionOne orchestration public http://${controllerHost}:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration internal http://${controllerHost}:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration admin http://${controllerHost}:8004/v1/%\(tenant_id\)s
openstack service create --name heat-cfn --description "Orchestration" cloudformation
openstack endpoint create --region RegionOne cloudformation public http://${controllerHost}:8000/v1
openstack endpoint create --region RegionOne cloudformation internal http://${controllerHost}:8000/v1
openstack endpoint create --region RegionOne cloudformation admin http://${controllerHost}:8000/v1
openstack domain create --description "Stack projects and users" heat
openstack user create --domain heat --password ${HEAT_PASSWD} 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
yum -y install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine
openstack-config --set /etc/heat/heat.conf database connection mysql+pymysql://heat:${HEAT_PASSWD}@${controllerHost}/heat
openstack-config --set /etc/heat/heat.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_uri http://${controllerHost}:5000
openstack-config --set /etc/heat/heat.conf keystone_authtoken auth_url http://${controllerHost}:35357
openstack-config --set /etc/heat/heat.conf keystone_authtoken memcached_servers ${controllerHost}: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 ${HEAT_PASSWD}
openstack-config --set /etc/heat/heat.conf trustee auth_type password
openstack-config --set /etc/heat/heat.conf trustee auth_url http://${controllerHost}:35357
openstack-config --set /etc/heat/heat.conf trustee username heat
openstack-config --set /etc/heat/heat.conf trustee password ${HEAT_PASSWD}
openstack-config --set /etc/heat/heat.conf trustee user_domain_name default
openstack-config --set /etc/heat/heat.conf clients_keystone auth_uri http://${controllerHost}:5000
openstack-config --set /etc/heat/heat.conf DEFAULT heat_metadata_server_url http://${controllerHost}:8000
openstack-config --set /etc/heat/heat.conf DEFAULT heat_waitcondition_server_url http://${controllerHost}: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 ${HEAT_PASSWD}
openstack-config --set /etc/heat/heat.conf DEFAULT stack_user_domain_name heat
su -s /bin/sh -c "heat-manage db_sync" heat
systemctl enable openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl start openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl status openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
}