#!/bin/bash set -eux OS_AUTH_URL=${OS_AUTH_URL:-""} if [ -z "$OS_AUTH_URL" ]; then echo "You must source a stackrc file for the Undercloud." exit 1 fi # setup-baremetal requires this to be set export TRIPLEO_ROOT=. export NODES_JSON=${NODES_JSON:-"instackenv.json"} export USE_IRONIC=1 export ROOT_DISK=${ROOT_DISK:-10} register-nodes --service-host undercloud --nodes <(jq '.nodes' $NODES_JSON) # Must wait for baremetal nodes to register as nova hypervisors expected_nodes=$(jq ".nodes | length" $NODES_JSON) expected_memory=$(jq ".nodes | map(.memory | tonumber) | add" $NODES_JSON) expected_vcpus=$(jq ".nodes | map(.cpu | tonumber) | add" $NODES_JSON) tripleo wait_for 180 1 wait_for_hypervisor_stats $expected_nodes $expected_memory $expected_vcpus tripleo setup-overcloud-passwords -o tripleo-overcloud-passwords source tripleo-overcloud-passwords # Undercloud passwords must all be sourced into this script since we make use # of $UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD below source tripleo-undercloud-passwords # Define the interface that will be bridged onto the Neutron defined # network. NeutronPublicInterface=${NeutronPublicInterface:-eth0} NEUTRON_NETWORK_TYPE=${NEUTRON_NETWORK_TYPE:-gre} # Define the overcloud libvirt type for virtualization. kvm for # baremetal, qemu for an overcloud running in vm's. OVERCLOUD_LIBVIRT_TYPE=${OVERCLOUD_LIBVIRT_TYPE:-qemu} COMPUTESCALE=${COMPUTESCALE:-1} BLOCKSTORAGESCALE=${BLOCKSTORAGESCALE:-1} SWIFTSTORAGESCALE=${SWIFTSTORAGESCALE:-1} # Default flavor parameters export OVERCLOUD_CONTROL_FLAVOR=${OVERCLOUD_CONTROL_FLAVOR:-"baremetal"} export OVERCLOUD_COMPUTE_FLAVOR=${OVERCLOUD_COMPUTE_FLAVOR:-"baremetal"} export OVERCLOUD_BLOCKSTORAGE_FLAVOR=${OVERCLOUD_BLOCKSTORAGE_FLAVOR:-"baremetal"} export OVERCLOUD_SWIFTSTORAGE_FLAVOR=${OVERCLOUD_SWIFTSTORAGE_FLAVOR:-"baremetal"} if [ -d /usr/share/openstack-tripleo-heat-templates ]; then tripleo-heat-merge \ --included-template-dir /usr/share/openstack-tripleo-heat-templates \ --scale NovaCompute=$COMPUTESCALE \ --scale BlockStorage=$BLOCKSTORAGESCALE \ --scale SwiftStorage=$SWIFTSTORAGESCALE \ /usr/share/openstack-tripleo-heat-templates/overcloud-source.yaml \ /usr/share/openstack-tripleo-heat-templates/swift-source.yaml \ /usr/share/openstack-tripleo-heat-templates/swift-storage-source.yaml \ /usr/share/openstack-tripleo-heat-templates/ssl-source.yaml \ /usr/share/openstack-tripleo-heat-templates/block-storage.yaml ${EXTRA_MERGE_TEMPLATES:-} \ > overcloud.yaml OVERCLOUD_YAML_PATH=overcloud.yaml export OVERCLOUD_PARAMETERS=${OVERCLOUD_PARAMETERS:-"\ -P AdminPassword=${OVERCLOUD_ADMIN_PASSWORD} \ -P AdminToken=${OVERCLOUD_ADMIN_TOKEN} \ -P CinderPassword=${OVERCLOUD_CINDER_PASSWORD} \ -P GlanceLogFile=\"''\" \ -P GlancePassword=${OVERCLOUD_GLANCE_PASSWORD} \ -P HeatPassword=${OVERCLOUD_HEAT_PASSWORD} \ -P NeutronDnsmasqOptions=\"dhcp-option-force=26,1400\" \ -P NeutronPassword=${OVERCLOUD_NEUTRON_PASSWORD} \ -P NeutronPublicInterface=$NeutronPublicInterface \ -P NovaComputeLibvirtType=$OVERCLOUD_LIBVIRT_TYPE \ -P NovaPassword=${OVERCLOUD_NOVA_PASSWORD} \ -P SwiftHashSuffix=${OVERCLOUD_SWIFT_HASH} \ -P SwiftPassword=${OVERCLOUD_SWIFT_PASSWORD} \ "} HEAT_ENVIRONMENT="" else make -C $INSTACK_ROOT/tripleo-heat-templates-instack overcloud.yaml COMPUTESCALE=$COMPUTESCALE BLOCKSTORAGESCALE=$BLOCKSTORAGESCALE SWIFTSTORAGESCALE=$SWIFTSTORAGESCALE OVERCLOUD_YAML_PATH=$INSTACK_ROOT/tripleo-heat-templates-instack/overcloud.yaml NeutronControlPlaneID=$(neutron net-show ctlplane | grep ' id ' | awk '{print $4}') export OVERCLOUD_PARAMETERS=${OVERCLOUD_PARAMETERS:-"\ -P AdminPassword=${OVERCLOUD_ADMIN_PASSWORD} \ -P AdminToken=${OVERCLOUD_ADMIN_TOKEN} \ -P CeilometerPassword=${OVERCLOUD_CEILOMETER_PASSWORD} \ -P CeilometerMeteringSecret=${OVERCLOUD_CEILOMETER_SECRET} \ -P CinderPassword=${OVERCLOUD_CINDER_PASSWORD} \ -P CinderISCSIHelper=lioadm \ -P CloudName=overcloud \ -P GlancePassword=${OVERCLOUD_GLANCE_PASSWORD} \ -P HeatPassword=${OVERCLOUD_HEAT_PASSWORD} \ -P NeutronControlPlaneID=$NeutronControlPlaneID \ -P NeutronDnsmasqOptions=dhcp-option-force=26,1400 \ -P NeutronPassword=${OVERCLOUD_NEUTRON_PASSWORD} \ -P NeutronPublicInterface=$NeutronPublicInterface \ -P NovaComputeLibvirtType=$OVERCLOUD_LIBVIRT_TYPE \ -P NovaPassword=${OVERCLOUD_NOVA_PASSWORD} \ -P SwiftHashSuffix=${OVERCLOUD_SWIFT_HASH} \ -P SwiftPassword=${OVERCLOUD_SWIFT_PASSWORD} \ -P NeutronNetworkType=${NEUTRON_NETWORK_TYPE} \ -P NeutronTunnelTypes=${NEUTRON_TUNNEL_TYPES} \ -P SnmpdReadonlyUserPassword=${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD} \ -P OvercloudControlFlavor=${OVERCLOUD_CONTROL_FLAVOR} \ -P OvercloudComputeFlavor=${OVERCLOUD_COMPUTE_FLAVOR} \ -P OvercloudBlockStorageFlavor=${OVERCLOUD_BLOCKSTORAGE_FLAVOR} \ -P OvercloudSwiftStorageFlavor=${OVERCLOUD_SWIFTSTORAGE_FLAVOR} \ "} HEAT_ENV=${HEAT_ENV:-"${INSTACK_ROOT}/overcloud-env.json"} ENV_JSON='{"parameters":{}}' jq . > "${HEAT_ENV}" <<< $ENV_JSON chmod 0600 "${HEAT_ENV}" generate-keystone-pki --heatenv $HEAT_ENV HEAT_ENVIRONMENT="-e ${HEAT_ENV}" fi heat stack-create -f $OVERCLOUD_YAML_PATH \ $OVERCLOUD_PARAMETERS \ $HEAT_ENVIRONMENT \ overcloud tripleo wait_for_stack_ready 220 10 overcloud echo "Overcloud CREATE_COMPLETE" if [ -d /etc/tripleo ]; then TRIPLEO_ROOT=/etc/tripleo else TRIPLEO_ROOT=$INSTACK_ROOT/tripleo-incubator fi OVERCLOUD_ENDPOINT=$(heat output-show overcloud KeystoneURL|sed 's/^"\(.*\)"$/\1/') export OVERCLOUD_IP=$(echo $OVERCLOUD_ENDPOINT | awk -F '[/:]' '{print $4}') touch ~/.ssh/known_hosts chmod 600 ~/.ssh/known_hosts ssh-keygen -R $OVERCLOUD_IP export no_proxy=${no_proxy:-""} export no_proxy=$no_proxy,$OVERCLOUD_IP NEW_JSON=$(jq '.overcloud.password="'${OVERCLOUD_ADMIN_PASSWORD}'" | .overcloud.endpoint="'${OVERCLOUD_ENDPOINT}'" | .overcloud.endpointhost="'${OVERCLOUD_IP}'"' $NODES_JSON) echo $NEW_JSON > $NODES_JSON export TE_DATAFILE=$NODES_JSON source $TRIPLEO_ROOT/overcloudrc if [ -z "$INSTACK_ROOT" ]; then tripleo init-keystone -p $OVERCLOUD_ADMIN_PASSWORD $OVERCLOUD_ADMIN_TOKEN \ $OVERCLOUD_IP admin@example.com heat-admin@$OVERCLOUD_IP \ ${SSLBASE:+--ssl $PUBLIC_API_URL} REGISTER_SERVICE_OPTS= else init-keystone -o $OVERCLOUD_IP -t $OVERCLOUD_ADMIN_TOKEN \ -e admin.example.com -p $OVERCLOUD_ADMIN_PASSWORD -u heat-admin \ ${SSLBASE:+-s $PUBLIC_API_URL} # REGISTER_SERVICE_OPTS="--ceilometer-password $OVERCLOUD_CEILOMETER_PASSWORD " REGISTER_SERVICE_OPTS="" keystone role-create --name=swiftoperator keystone role-create --name=ResellerAdmin fi tripleo setup-endpoints $OVERCLOUD_IP \ --cinder-password $OVERCLOUD_CINDER_PASSWORD \ --glance-password $OVERCLOUD_GLANCE_PASSWORD \ --heat-password $OVERCLOUD_HEAT_PASSWORD \ --neutron-password $OVERCLOUD_NEUTRON_PASSWORD \ --nova-password $OVERCLOUD_NOVA_PASSWORD \ --swift-password $OVERCLOUD_SWIFT_PASSWORD \ $REGISTER_SERVICE_OPTS \ ${SSLBASE:+--ssl $PUBLIC_API_URL} keystone role-create --name heat_stack_user # setup-neutron "" "" 10.0.0.0/8 "" "" "" "" 192.0.2.45 192.0.2.64 192.0.2.0/24 NETWORK_CIDR=${NETWORK_CIDR:-"10.0.0.0/8"} FLOATING_IP_START=${FLOATING_IP_START:-"172.17.0.45"} FLOATING_IP_END=${FLOATING_IP_END:-"172.17.0.64"} FLOATING_IP_CIDR=${FLOATING_IP_CIDR:-"172.17.0.0/16"} tripleo setup-neutron "" "" $NETWORK_CIDR "" "" "" "" $FLOATING_IP_START $FLOATING_IP_END $FLOATING_IP_CIDR nova flavor-delete m1.tiny nova flavor-create m1.tiny 1 512 2 1 echo "Overcloud Deployed"