labs: Adds orchestration service to osbash
Following actions are performed by this patch: 1) Adds the heat packages to the pre-download script 2) Adds OpenStack orchestration service - heat on controller node 3) Adds verification steps for heat installation Change-Id: Id9241b64af010c314a107330ef39f0ffcc9211b7
This commit is contained in:
parent
8b9835dfea
commit
46e71fee16
@ -35,6 +35,9 @@ cmd snapshot_cycle -n controller openstack_networks_configured
|
|||||||
cmd queue setup_lbaas_controller.sh
|
cmd queue setup_lbaas_controller.sh
|
||||||
cmd snapshot_cycle -n controller controller_node_installed
|
cmd snapshot_cycle -n controller controller_node_installed
|
||||||
|
|
||||||
|
cmd queue ubuntu/setup_heat_controller.sh
|
||||||
|
cmd snapshot_cycle -n controller heat_controller_installed
|
||||||
|
|
||||||
cmd boot -n controller
|
cmd boot -n controller
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
# Scripts for compute node
|
# Scripts for compute node
|
||||||
@ -71,6 +74,10 @@ cmd snapshot_cycle -n network neutron_configured
|
|||||||
|
|
||||||
cmd queue ubuntu/setup_lbaas_network.sh
|
cmd queue ubuntu/setup_lbaas_network.sh
|
||||||
cmd snapshot_cycle -n network network_node_installed
|
cmd snapshot_cycle -n network network_node_installed
|
||||||
|
|
||||||
|
cmd queue ubuntu/setup_heat_network.sh
|
||||||
|
cmd snapshot_cycle -n network heat_network_installed
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Take snapshot of database changes on controller VM, too
|
# Take snapshot of database changes on controller VM, too
|
||||||
cmd queue shutdown_controller.sh
|
cmd queue shutdown_controller.sh
|
||||||
|
@ -82,3 +82,6 @@ apt_download neutron-common neutron-plugin-ml2 \
|
|||||||
# Neutron Network
|
# Neutron Network
|
||||||
apt_download neutron-common neutron-plugin-ml2 \
|
apt_download neutron-common neutron-plugin-ml2 \
|
||||||
neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent
|
neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent
|
||||||
|
|
||||||
|
# Heat
|
||||||
|
apt_download heat-api heat-api-cfn heat-engine python-heatclient
|
||||||
|
122
labs/scripts/ubuntu/setup_heat_controller.sh
Executable file
122
labs/scripts/ubuntu/setup_heat_controller.sh
Executable file
@ -0,0 +1,122 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -o errexit -o nounset
|
||||||
|
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||||
|
source "$TOP_DIR/config/paths"
|
||||||
|
source "$CONFIG_DIR/credentials"
|
||||||
|
source "$LIB_DIR/functions.guest"
|
||||||
|
|
||||||
|
exec_logfile
|
||||||
|
|
||||||
|
indicate_current_auto
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Install the Orchestration Service (heat).
|
||||||
|
# http://docs.openstack.org/juno/install-guide/install/apt/content/heat-install-controller-node.html
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
echo "Setting up database for heat."
|
||||||
|
setup_database heat
|
||||||
|
|
||||||
|
echo "Sourcing the admin credentials."
|
||||||
|
source "$CONFIG_DIR/admin-openstackrc.sh"
|
||||||
|
|
||||||
|
heat_admin_user=$(service_to_user_name heat)
|
||||||
|
heat_admin_password=$(service_to_user_password heat)
|
||||||
|
|
||||||
|
echo "Creating heat user and giving it admin role under service tenant."
|
||||||
|
keystone user-create \
|
||||||
|
--name "$heat_admin_user" \
|
||||||
|
--pass "$heat_admin_password" \
|
||||||
|
|
||||||
|
keystone user-role-add \
|
||||||
|
--user "$heat_admin_user" \
|
||||||
|
--tenant "$SERVICE_TENANT_NAME" \
|
||||||
|
--role "$ADMIN_ROLE_NAME"
|
||||||
|
|
||||||
|
echo "Creating the heat stack owner role."
|
||||||
|
keystone role-create --name "heat_stack_owner"
|
||||||
|
|
||||||
|
keystone user-role-add \
|
||||||
|
--user "$DEMO_USER_NAME" \
|
||||||
|
--tenant "$DEMO_TENANT_NAME" \
|
||||||
|
--role heat_stack_owner
|
||||||
|
|
||||||
|
echo "Creating the heat stack user role."
|
||||||
|
keystone role-create --name "heat_stack_user"
|
||||||
|
|
||||||
|
echo "Registering heat with keystone so that other services can locate it."
|
||||||
|
keystone service-create \
|
||||||
|
--name heat \
|
||||||
|
--type orchestration \
|
||||||
|
--description "Orchestration"
|
||||||
|
|
||||||
|
keystone service-create \
|
||||||
|
--name heat-cfn \
|
||||||
|
--type cloudformation \
|
||||||
|
--description "Orchestration"
|
||||||
|
|
||||||
|
|
||||||
|
heat_service_id=$(keystone service-list | awk '/ orchestration / {print $2}')
|
||||||
|
keystone endpoint-create \
|
||||||
|
--service-id "$heat_service_id" \
|
||||||
|
--publicurl "http://controller-api:8004/v1/%(tenant_id)s" \
|
||||||
|
--internalurl "http://controller-mgmt:8004/v1/%(tenant_id)s" \
|
||||||
|
--adminurl "http://controller-mgmt:8004/v1/%(tenant_id)s" \
|
||||||
|
--region "$REGION"
|
||||||
|
|
||||||
|
heatcfn_service_id=$(keystone service-list | awk '/ cloudformation / {print $2}')
|
||||||
|
keystone endpoint-create \
|
||||||
|
--service-id "$heatcfn_service_id" \
|
||||||
|
--publicurl "http://controller-api:8000/v1" \
|
||||||
|
--internalurl "http://controller-mgmt:8000/v1" \
|
||||||
|
--adminurl "http://controller-mgmt:8000/v1" \
|
||||||
|
--region "$REGION"
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing heat."
|
||||||
|
sudo apt-get install -y heat-api heat-api-cfn heat-engine \
|
||||||
|
python-heatclient
|
||||||
|
|
||||||
|
function get_database_url {
|
||||||
|
local db_user=$(service_to_db_user heat)
|
||||||
|
local db_password=$(service_to_db_password heat)
|
||||||
|
local database_host=controller-mgmt
|
||||||
|
|
||||||
|
echo "mysql://$db_user:$db_password@$database_host/heat"
|
||||||
|
}
|
||||||
|
|
||||||
|
database_url=$(get_database_url)
|
||||||
|
echo "Database connection: $database_url."
|
||||||
|
|
||||||
|
echo "Configuring heat.conf."
|
||||||
|
conf=/etc/heat/heat.conf
|
||||||
|
iniset_sudo $conf database connection "$database_url"
|
||||||
|
|
||||||
|
echo "Configuring [DEFAULT] section in /etc/heat/heat.conf."
|
||||||
|
|
||||||
|
iniset_sudo $conf DEFAULT rpc_backend rabbit
|
||||||
|
iniset_sudo $conf DEFAULT rabbit_host controller-mgmt
|
||||||
|
iniset_sudo $conf DEFAULT rabbit_password "$RABBIT_PASSWORD"
|
||||||
|
|
||||||
|
|
||||||
|
iniset_sudo $conf keystone_authtoken auth_uri "http://controller-mgmt:5000/v2.0"
|
||||||
|
iniset_sudo $conf keystone_authtoken identity_uri "http://controller-mgmt:35357"
|
||||||
|
iniset_sudo $conf keystone_authtoken admin_tenant_name "$SERVICE_TENANT_NAME"
|
||||||
|
iniset_sudo $conf keystone_authtoken admin_user "$heat_admin_user"
|
||||||
|
iniset_sudo $conf keystone_authtoken admin_password "$heat_admin_password"
|
||||||
|
iniset_sudo $conf ec2authtoken auth_uri "http://controller-mgmt:5000/v2.0"
|
||||||
|
iniset_sudo $conf DEFAULT heat_metadata_server_url "http://controller-mgmt:8000"
|
||||||
|
iniset_sudo $conf DEFAULT heat_waitcondition_server_url "http://controller-mgmt:8000/v1/waitcondition"
|
||||||
|
iniset_sudo $conf DEFAULT verbose True
|
||||||
|
|
||||||
|
|
||||||
|
echo "Creating the database tables for heat."
|
||||||
|
sudo heat-manage db_sync
|
||||||
|
|
||||||
|
echo "Restarting heat service."
|
||||||
|
sudo service heat-api restart
|
||||||
|
sudo service heat-api-cfn restart
|
||||||
|
sudo service heat-engine restart
|
||||||
|
|
||||||
|
echo "Removing default SQLite database."
|
||||||
|
sudo rm -f /var/lib/heat/heat.sqlite
|
78
labs/scripts/ubuntu/setup_heat_network.sh
Executable file
78
labs/scripts/ubuntu/setup_heat_network.sh
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -o errexit -o nounset
|
||||||
|
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||||
|
source "$TOP_DIR/config/paths"
|
||||||
|
source "$CONFIG_DIR/credentials"
|
||||||
|
source "$LIB_DIR/functions.guest"
|
||||||
|
source "$CONFIG_DIR/openstack"
|
||||||
|
|
||||||
|
exec_logfile
|
||||||
|
|
||||||
|
indicate_current_auto
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Verify the Orchestration Service installation
|
||||||
|
# http://docs.openstack.org/juno/install-guide/install/apt/content/heat-verify.html
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
echo "Verifying heat installation."
|
||||||
|
|
||||||
|
echo "Waiting for heat-engine to start."
|
||||||
|
|
||||||
|
AUTH="source $CONFIG_DIR/demo-openstackrc.sh"
|
||||||
|
until node_ssh controller-mgmt "$AUTH; heat stack-list" >/dev/null 2>&1; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Creating a test heat template."
|
||||||
|
|
||||||
|
node_ssh controller-mgmt "echo '
|
||||||
|
heat_template_version: 2014-10-16
|
||||||
|
description: A simple 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 in the private network
|
||||||
|
value: { get_attr: [ server, first_address ] }' > test-stack.yml"
|
||||||
|
|
||||||
|
NET_ID=$(node_ssh controller-mgmt "$AUTH; nova net-list" | awk '/ demo-net / { print $2 }')
|
||||||
|
img_name=$(basename "$CIRROS_URL" -disk.img)
|
||||||
|
|
||||||
|
node_ssh controller-mgmt "$AUTH; heat stack-create -f test-stack.yml \
|
||||||
|
-P 'ImageID=$img_name;NetID=$NET_ID' testStack"
|
||||||
|
|
||||||
|
echo "Verifying successful creation of stack."
|
||||||
|
|
||||||
|
cnt=0
|
||||||
|
echo "heat stack-list"
|
||||||
|
until node_ssh controller-mgmt "$AUTH; heat stack-list" 2>/dev/null | grep "CREATE_COMPLETE"; do
|
||||||
|
cnt=$((cnt + 1))
|
||||||
|
if [ $cnt -eq 60 ]; then
|
||||||
|
echo "Heat stack creation failed. Exiting."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Deleting the test stack."
|
||||||
|
heat_stack_id=$(node_ssh controller-mgmt "$AUTH; heat stack-list" | awk '/ testStack / {print $2}')
|
||||||
|
|
||||||
|
node_ssh controller-mgmt "$AUTH; heat stack-delete $heat_stack_id"
|
Loading…
x
Reference in New Issue
Block a user