7 echo "Starting the Apex baremetal deployment."
8 echo "--------------------------------------------------------"
11 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
12 # if artifact name is passed the pull a
13 # specific artifact from artifacts.opnfv.org
14 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
16 if [[ $BUILD_DIRECTORY == *apex-build* ]]; then
17 BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY
18 echo "BUILD DIRECTORY modified to $BUILD_DIRECTORY"
20 if [[ -f ${BUILD_DIRECTORY}/../opnfv.properties ]]; then
21 # if opnfv.properties exists then use the
22 # local build. Source the file so we get local OPNFV vars
23 source ${BUILD_DIRECTORY}/../opnfv.properties
24 RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL)
26 # no opnfv.properties means use the latest from artifacts.opnfv.org
27 # get the latest.properties to get the link to the latest artifact
28 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
29 [[ -f opnfv.properties ]] || exit 1
30 # source the file so we get OPNFV vars
31 source opnfv.properties
32 RPM_INSTALL_PATH=$OPNFV_RPM_URL
36 if [ ! -e "$RPM_INSTALL_PATH" ]; then
37 RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
40 RPM_LIST=$RPM_INSTALL_PATH
41 for pkg in common undercloud; do
42 RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}"
45 # update / install the new rpm
46 if rpm -q opnfv-apex > /dev/null; then
47 if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
48 echo "RPM is already installed"
49 elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then
50 if ! sudo yum downgrade -y $RPM_LIST; then
51 sudo yum remove -y opnfv-undercloud opnfv-common
52 sudo yum downgrade -y $RPM_INSTALL_PATH
56 sudo yum install -y $RPM_LIST;
59 # cleanup environment before we start
61 # initiate baremetal deployment
62 if [ -e /etc/opnfv-apex/network_settings.yaml ]; then
63 if [ -n "$DEPLOY_SCENARIO" ]; then
64 echo "Deploy Scenario set to ${DEPLOY_SCENARIO}"
65 if [ -e /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml ]; then
66 sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
67 -d /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml \
68 -n /root/network/network_settings.yaml --debug
70 echo "File does not exist /etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml"
74 echo "Deploy scenario not set!"
78 echo "File /etc/opnfv-apex/network_settings.yaml does not exist!"
83 echo "--------------------------------------------------------"