tripleo-ci/scripts/bootstrap-overcloud-full.sh

113 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
set -eux
export STABLE_RELEASE=${STABLE_RELEASE:-""}
# Source deploy.env if it exists. It should exist if we are running under
# tripleo-ci
export TRIPLEO_ROOT=${TRIPLEO_ROOT:-"/opt/stack/new"}
if [ -f "$TRIPLEO_ROOT/tripleo-ci/deploy.env" ]; then
source $TRIPLEO_ROOT/tripleo-ci/deploy.env
fi
# Ensure epel-release is not installed
sudo yum erase -y epel-release || :
# Copied from toci_gate_test.sh...need to apply this fix on subnodes as well
# TODO(pabelanger): Why is python-requests installed from pip?
sudo rm -rf /usr/lib/python2.7/site-packages/requests
# Reinstall python-requests if it was already installed, otherwise it will be
# installed later when other packages are installed.
if rpm -q python-requests; then
sudo yum reinstall -y python-requests
fi
# Clear out any puppet modules on the node placed their by infra configuration
sudo rm -rf /etc/puppet/modules/*
# This will remove any puppet configuration done my infra setup
sudo yum -y remove puppet facter hiera
# Update everything
sudo yum -y update
# instack-undercloud will pull in all the needed deps
# git needed since puppet modules installed from source
# openstack-tripleo-common needed for the tripleo-build-images command
sudo yum -y install instack-undercloud git openstack-tripleo-common
# detect the real path depending on diskimage-builder version
COMMON_ELEMENTS_PATH=$(python -c '
try:
import diskimage_builder.paths
diskimage_builder.paths.show_path("elements")
except:
print("/usr/share/diskimage-builder/elements")
')
export ELEMENTS_PATH="${COMMON_ELEMENTS_PATH}:/usr/share/instack-undercloud:/usr/share/tripleo-image-elements:/usr/share/tripleo-puppet-elements:/usr/share/openstack-heat-templates/software-config/elements"
sudo yum -y install openstack-tripleo-common
if [[ "${STABLE_RELEASE}" =~ ^(liberty|mitaka)$ ]] ; then
ELEMENTS=$(\
tripleo-build-images \
--image-json-output \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images-centos7.yaml \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images.yaml \
| jq '. | map(select(.imagename == "overcloud-full")) | .[0].elements | map(.+" ") | add' \
| sed 's/"//g')
else
ELEMENTS=$(\
tripleo-build-images \
--image-json-output \
--image-name overcloud-full \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images-centos7.yaml \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images.yaml \
| jq '. | .[0].elements | map(.+" ") | add' \
| sed 's/"//g')
fi
# delorean-repo is excluded b/c we've already run --repo-setup on this node and
# we don't want to overwrite that.
sudo -E instack \
-e centos7 \
enable-packages-install \
install-types \
$ELEMENTS \
-k extra-data \
pre-install \
install \
post-install \
-b 05-fstab-rootfs-label \
00-fix-requiretty \
90-rebuild-ramdisk \
00-usr-local-bin-secure-path \
-x delorean-repo \
-d
if [[ "${STABLE_RELEASE}" =~ ^(liberty|mitaka)$ ]] ; then
PACKAGES=$(\
tripleo-build-images \
--image-json-output \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images-centos7.yaml \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images.yaml \
| jq '. | map(select(.imagename == "overcloud-full")) | .[0].packages | .[] | tostring' \
| sed 's/"//g')
else
PACKAGES=$(\
tripleo-build-images \
--image-json-output \
--image-name overcloud-full \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images-centos7.yaml \
--image-config-file /usr/share/tripleo-common/image-yaml/overcloud-images.yaml \
| jq '. | .[0].packages | .[] | tostring' \
| sed 's/"//g')
fi
# Install additional packages expected by the image
sudo yum -y install $PACKAGES
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
sudo setenforce 0