Skip to content

Instantly share code, notes, and snippets.

@enakai00
Created January 10, 2014 08:14
Show Gist options
  • Save enakai00/8348486 to your computer and use it in GitHub Desktop.
Save enakai00/8348486 to your computer and use it in GitHub Desktop.
#!/bin/sh -xe
. /reoot/keystonerc_admin
export MYSQL_ROOT_PASSWORD=$(grep CONFIG_MYSQL_PW /root/quickrdo/controller.txt | cut -f2 -d=)
export HEAT_DB_PASSWORD_OF_CHOICE=pas4heat
yum -y install "openstack-heat-*" python-heatclient
heat-db-setup rpm -y -r ${MYSQL_ROOT_PASSWORD} -p ${HEAT_DB_PASSWORD_OF_CHOICE}
sed -i "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e '/1 "%02x"' /dev/random`/" /etc/heat/heat-engine.conf
export SERVICES_TENANT_ID=$(keystone tenant-list | grep " services " | cut -d"|" -f2 | sed 's/ //g')
export SERVICES_TENANT_NAME=services
keystone user-create --name heat --pass passw0rd --tenant-id ${SERVICES_TENANT_ID}
keystone user-role-add --user heat --role admin --tenant ${SERVICES_TENANT_NAME}
keystone service-create --name heat --type orchestration
keystone service-create --name heat-cfn --type cloudformation
export HEAT_CFN_SERVICE_ID=$(keystone service-list | grep " heat-cfn " | cut -d"|" -f2 | sed 's/ //g')
export HEAT_CFN_HOSTNAME=localhost
export HEAT_SERVICE_ID=$(keystone service-list | grep " heat " | cut -d"|" -f2 | sed 's/ //g')
export HEAT_HOSTNAME=localhost
keystone endpoint-create --region RegionOne --service-id ${HEAT_CFN_SERVICE_ID} --publicurl "http://${HEAT_CFN_HOSTNAME}:8000/v1" --adminurl "http://${HEAT_CFN_HOSTNAME}:8000/v1" --internalurl "http://${HEAT_CFN_HOSTNAME}:8000/v1"
keystone endpoint-create --region RegionOne --service-id ${HEAT_SERVICE_ID} --publicurl "http://${HEAT_HOSTNAME}:8004/v1/%(tenant_id)s" --adminurl "http://${HEAT_HOSTNAME}:8004/v1/%(tenant_id)s" --internalurl "http://${HEAT_HOSTNAME}:8004/v1/%(tenant_id)s"
for file in $(ls /etc/heat/heat-api{,-cfn,-cloudwatch}-paste.ini); do
sed -i 's/admin_tenant_name = .*/admin_tenant_name = services/' $file
sed -i 's/admin_user = .*/admin_user = heat/' $file
sed -i 's/admin_password = .*/admin_password = passw0rd/' $file
done
HOSTIP=$(facter ipaddress)
sed -i "s/heat_metadata_server_url = .*/heat_metadata_server_url = http:\/\/${HOSTIP}:8000/" /etc/heat/heat-engine.conf
sed -i "s/heat_waitcondition_server_url = .*/heat_waitcondition_server_url = http:\/\/${HOSTIP}:8000\/v1\/waitcondition/" /etc/heat/heat-engine.conf
sed -i "s/heat_watch_server_url = .*/heat_watch_server_url = http:\/\/${HOSTIP}:8003/" /etc/heat/heat-engine.conf
keystone role-create --name heat_stack_user
cd /usr/lib/systemd/system
ls openstack-heat* | sed 's/.service//' | xargs sudo systemctl enable
ls openstack-heat* | sed 's/.service//' | xargs sudo systemctl start
sed -i '/^-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT/a -A INPUT -p tcp --dport 8003 -j ACCEPT' /etc/sysconfig/iptables
sed -i '/^-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT/a -A INPUT -p tcp --dport 8000 -j ACCEPT' /etc/sysconfig/iptables
systemctl restart iptables.service
systemctl reload libvirtd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment