2021-10-12 19:24:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-12 19:36:06 +00:00
|
|
|
# Used for debugging
|
|
|
|
# set -ax
|
2021-10-12 19:24:31 +00:00
|
|
|
|
|
|
|
# This script is required after a reboot of the cloud after the cloud has been
|
|
|
|
# shut down
|
|
|
|
|
2024-09-30 09:19:55 +00:00
|
|
|
. functions.sh
|
2022-10-24 10:37:22 +00:00
|
|
|
check_juju_version
|
|
|
|
|
2023-09-25 09:44:42 +00:00
|
|
|
juju-wait -v ${model}
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2024-09-30 09:19:55 +00:00
|
|
|
get_juju_status
|
2021-10-12 19:36:06 +00:00
|
|
|
|
2024-09-30 09:19:55 +00:00
|
|
|
# Check if we're using percona-cluster and/or mysql-innodb-cluster
|
2023-09-25 09:44:42 +00:00
|
|
|
percona_cluster=$(jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"percona-cluster\") | .key" "${juju_status_out}")
|
|
|
|
mysql_innodb_cluster=$(jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"mysql-innodb-cluster\") | .key" "${juju_status_out}")
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2022-07-01 19:28:36 +00:00
|
|
|
if [[ -n "${percona_cluster}" ]] ; then
|
2024-09-30 09:19:55 +00:00
|
|
|
do_percona_cluster
|
2021-10-12 19:24:31 +00:00
|
|
|
fi
|
|
|
|
|
2022-07-01 19:28:36 +00:00
|
|
|
if [[ -n "${mysql_innodb_cluster}" ]] ; then
|
2024-09-30 09:19:55 +00:00
|
|
|
do_mysql_innodb_cluster
|
2022-07-01 19:28:36 +00:00
|
|
|
fi
|
|
|
|
|
2022-10-24 10:37:22 +00:00
|
|
|
${juju_run} -u elasticsearch/leader -- sudo systemctl restart elasticsearch &
|
|
|
|
${juju_run} -a heat -- sudo systemctl restart heat-engine &
|
2024-09-30 09:19:55 +00:00
|
|
|
${juju_run} -a ceph-radosgw -- 'sudo systemctl restart ceph-radosgw@*' &
|
2021-10-12 19:36:06 +00:00
|
|
|
|
|
|
|
wait
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2021-10-12 19:36:06 +00:00
|
|
|
# cleanup all crm resources
|
2023-09-25 09:44:42 +00:00
|
|
|
jq -r ".applications | to_entries[] | select(.value[\"charm-name\"] == \"hacluster\") | .key" "${juju_status_out}" \
|
2022-10-24 10:38:42 +00:00
|
|
|
| xargs -I{} ${juju_run} -u "{}"/leader -- 'sudo crm_resource -l | sed s/:.*//g | uniq | xargs -i sudo crm resource cleanup \"\{\}\"'
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2024-09-30 09:19:55 +00:00
|
|
|
do_vault restart
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2022-07-22 08:42:40 +00:00
|
|
|
# remove DNS entry for external network
|
2022-10-24 11:11:35 +00:00
|
|
|
${juju_run} --all -- "sudo sed -i -e s/192.168.1.13,//g -e s/192.168.1.9,//g /etc/netplan/99-juju.yaml"
|
|
|
|
${juju_run} --all -- "sudo netplan apply ; sudo systemctl restart systemd-resolved"
|
2021-10-12 19:24:31 +00:00
|
|
|
|
2024-09-30 09:19:55 +00:00
|
|
|
do_ceph
|
2021-10-12 19:36:06 +00:00
|
|
|
|
2023-09-25 09:44:42 +00:00
|
|
|
lds_servers=$(jq -rc ". | .applications[\"landscape-server\"].units | to_entries[] | .key" "${juju_status_out}")
|
2021-10-12 19:24:31 +00:00
|
|
|
|
|
|
|
cat > /tmp/restart-landscape.sh << EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
sudo systemctl restart landscape-*
|
|
|
|
EOF
|
|
|
|
|
|
|
|
for lds_server in ${lds_servers}
|
|
|
|
do
|
2023-09-25 09:44:42 +00:00
|
|
|
${juju_scp} /tmp/restart-landscape.sh "${lds_server}":.
|
|
|
|
${juju_ssh} "${lds_server}" chmod +x restart-landscape.sh
|
|
|
|
${juju_ssh} "${lds_server}" sudo ./restart-landscape.sh &
|
2021-10-12 19:24:31 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
wait
|
2023-02-22 14:16:27 +00:00
|
|
|
|
2023-09-25 09:44:42 +00:00
|
|
|
[[ $LMA_SERVERS == "off" ]] && ${juju_run} -m lma --all -- sudo halt -p
|