Add update-master-node script

This script updates master node in fuel 9.x releases.
It upgrades system packages, runs fuel/examples/deploy.sh
as for boostrap admin node process (puppet tasks run),
then restarts all important master node services.
Logging for this script is also added.

Closes-bug: #1605602

Related-bug: #1616472
Related-bug: #1616393

Change-Id: Ic4ef722b861d260c3679dca9c74f6cc62052c376
This commit is contained in:
Oleksiy Molchanov 2016-07-22 19:34:50 +03:00 committed by Dmitry Burmistrov
parent 32e516b9a1
commit 66229fdf42
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,66 @@
#!/bin/bash
set -ex
set -o pipefail
# setup logging
[ -d '/var/log/puppet' ] || mkdir -p /var/log/puppet
LOGFILE="${LOGFILE:-/var/log/puppet/update_master_node.log}"
exec > >(tee -i "${LOGFILE}")
exec 2>&1
echo "Master node update is <in progress> (log: ${LOGFILE} )"
echo '<STAGE>: Packages...'
# upgrade packages
yum clean all
yum update -y
# systemd: load fresh units
systemctl daemon-reload
echo '<STAGE>: Puppet...'
# re-apply puppet master node configuration
bash -x /etc/puppet/modules/fuel/examples/deploy.sh
echo '<STAGE>: Services...'
# restart services
SERVICES="
astute
cobblerd
mcollective
nailgun
nginx
openstack-keystone
ostf
rabbitmq-server
oswl_flavor_collectord
oswl_image_collectord
oswl_keystone_user_collectord
oswl_tenant_collectord
oswl_vm_collectord
oswl_volume_collectord
receiverd
statsenderd
assassind
"
echo "Restarting postgresql..."
systemctl restart postgresql
sleep 32
for service in $SERVICES; do
echo "Restarting ${service}..."
systemctl restart "$service"
done
echo; echo
echo "Master node update is <successfully complete> (log: ${LOGFILE} )"
exit 0

View File

@ -71,6 +71,7 @@ install -m 0755 %{fuel_utils_source}/dockerctl %{buildroot}/usr/bin
install -m 0755 %{fuel_utils_source}/flat_yaml.py %{buildroot}/usr/bin
install -m 0644 %{fuel_utils_source}/config %{buildroot}/etc/fuel-utils/config
install -m 0644 %{fuel_utils_source}/functions.sh %{buildroot}/usr/share/fuel-utils/functions.sh
install -m 0755 %{fuel_utils_source}/updates/update-master-node.sh %{buildroot}/usr/share/fuel-utils/update-master-node.sh
#fuel-misc
install -m 0755 %{files_source}/fuel-misc/centos_ifdown-local %{buildroot}/sbin/ifup-local
install -m 0755 %{files_source}/fuel-misc/logrotate %{buildroot}/usr/bin/fuel-logrotate
@ -173,6 +174,7 @@ This package contains a set of helpers to maintain Fuel services
/usr/bin/fuel-utils
/usr/bin/flat_yaml.py
/usr/share/fuel-utils/functions.sh
/usr/share/fuel-utils/update-master-node.sh
%config(noreplace) /etc/fuel-utils/config