| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | ####################################################################################### |
| 3 | # Copyright ETSI Contributors and Others. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 14 | # implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | ####################################################################################### |
| 18 | |
| garciadeblas | a4b669e | 2024-06-25 16:40:44 +0200 | [diff] [blame^] | 19 | ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@"${OSM_IP_ADDRESS}" \ |
| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 20 | 'sudo apt-get update -y && sudo apt-get upgrade -y && sudo reboot' |
| 21 | |
| 22 | sleep 90 |
| 23 | |
| 24 | # OSM installation |
| 25 | INSTALLER_PARAMETERS="-R ${REPO_BASE} -t ${DOCKER_TAG} -r ${REPO_NAME} -y" |
| 26 | echo "INSTALLER_URL: $INSTALLER_URL" |
| 27 | echo "INSTALLER_PARAMETERS: $INSTALLER_PARAMETERS" |
| garciadeblas | a4b669e | 2024-06-25 16:40:44 +0200 | [diff] [blame^] | 28 | ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} << EOF 2>&1 |
| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 29 | set -eux |
| 30 | wget "${INSTALLER_URL}" |
| 31 | chmod +x install_osm.sh |
| 32 | ./install_osm.sh ${INSTALLER_PARAMETERS} 2>&1 | tee osm_install_log.txt |
| 33 | set +eux |
| 34 | EOF |
| 35 | |
| 36 | # # Installs additional tools for telemetry |
| 37 | # set +eux |
| garciadeblas | a4b669e | 2024-06-25 16:40:44 +0200 | [diff] [blame^] | 38 | # ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} 'sudo apt-get install -y sysstat' |
| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 39 | # set -eux |
| 40 | |
| 41 | # Gets Juju password from LCM env file |
| 42 | set +eux |
| garciadeblas | a4b669e | 2024-06-25 16:40:44 +0200 | [diff] [blame^] | 43 | JUJU_PWD=$(ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} 'kubectl -n osm exec -ti deploy/lcm -- env | grep OSMLCM_VCA_SECRET | cut -d = -f 2') |
| aguilard | 8c0a054 | 2023-11-13 13:16:32 +0000 | [diff] [blame] | 44 | set -eux |
| 45 | |
| 46 | # Updates environment variables and logs them |
| 47 | export JUJU_PASSWORD="${JUJU_PWD}" |
| 48 | |
| 49 | # Logs new/updated environment variables |
| 50 | cat <<EOF >> ${ROBOT_REPORT_FOLDER}/osm_environment.rc |
| 51 | export JUJU_PASSWORD="${JUJU_PWD}" |
| 52 | EOF |
| 53 | |
| 54 | echo Environment was updated at ${ROBOT_REPORT_FOLDER}/osm_environment.rc |