Rocky 8 gw upgrade

back up script

echo "backing up ${1}"
rm -rf backups/${1}
mkdir -p backups/${1}/grid-security
scp -r -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk:/etc/grid-security/xrootd backups/${1}/grid-security
cp backups/${1}/grid-security/xrootd/* backups/${1}/grid-security
scp -r -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk:/etc/xrootd backups/${1}/xrootd
scp -r -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk:/var/lib/ceph/radosgw/ceph-rgw.${1}/keyring backups/${1}/keyring
scp -r -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk:/etc/ceph backups/${1}/ceph

aquilon os upgrade

aq manage --hostname ${1}.gridpp.rl.ac.uk --sandbox fur43467/jo-cmsd-internal
aq make --hostname ${1}.gridpp.rl.ac.uk --osname rocky --osversion 8x-x86_64
aq pxeswitch --install --hostname ${1}.gridpp.rl.ac.uk

reboot host

restore script

echo "restoring ${1}"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "dnf install -y rsync"
rsync -acvh backups/${1}/grid-security/ root@${1}.gridpp.rl.ac.uk:/etc/grid-security/
rsync -acvh backups/${1}/xrootd/ root@${1}.gridpp.rl.ac.uk:/etc/xrootd/
rsync -avch backups/${1}/ceph/ root@${1}.gridpp.rl.ac.uk:/etc/ceph/
scp backups/${1}/keyring root@${1}.gridpp.rl.ac.uk:/var/lib/ceph/radosgw/ceph-rgw.${1}/keyring || echo "no keyring"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "dnf remove -y rsync"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "chmod 644 /var/lib/ceph/radosgw/ceph-rgw.${1}/keyring"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "chown xrootd:xrootd /etc/xrootd/"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "chown xrootd:xrootd /etc/grid-security/xrootd/"
ssh -J fur43467@lcgui05.gridpp.rl.ac.uk root@${1}.gridpp.rl.ac.uk "quattor-fetch && quattor-configure --all && quattor-configure --nodeps --noautodeps network"