diff --git a/openstack/README.rst b/openstack/README.rst index 15522c18acdff929d7fbeb35c14380232cc3a368..b2618d4c20ddafc941dd0db89b26e8ef9a1c3fe5 100644 --- a/openstack/README.rst +++ b/openstack/README.rst @@ -1,3 +1,63 @@ +OpenStack backup scripts +======================== + +This directory contains scripts to create automated snapshots of OpenStack volumes. +The snapshots are deleted after a specified duration interval. + +Usage +----- + +First of all install the QEMU Guest Agent package inside the target OpenStack instance. e.g.:: + + sudo apt update && sudo apt install qemu-guest-agent + +The QEMU Guest Agent is a daemon which allows the creation of consistent volume snapshots while the instance is running. + +You will also need an OpenStack openrc file, possibly based on Application Credentials. +This can be obtained through the OpenStack dashboard, under Identity --> Application Credentials --> Create Application Credential --> set a name and other parameters if needed --> Create Application Credential --> Download openrc file. + + +The following scripts are included in this directory: + +- ``volume_snapshots.sh``, which creates the actual snapshots with a set retention interval; +- ``remove_old_snapshots.sh``, which removes the snapshot for which the retention interval has expired. + +Before using these scripts, you will need to edit them and substitute in each the line:: + + /home/ubuntu/rcs/app-cred-workplace_snapshots-openrc.sh + +with the path of your own openrc file. + + +volume_snapshots.sh +~~~~~~~~~~~~~~~~~~~ + +Usage:: + + ./volume_snapshot.sh <short_name> <volume ID> <region> [<retain seconds>] + +where: + +- ``short_name`` is a short identifier for the instance +- ``volume ID`` is the OpenStack volume UUID +- ``region`` is the OpenStack region in which the volume is located +- ``retain seconds`` is the number of seconds for which the snapshot will be retained. The default is 24 hours + +The script will perform a volume snapshot and include a metadata parameter with the chosen snapshot duration. + + +remove_old_snapshots.sh +~~~~~~~~~~~~~~~~~~~~~~~ + +Usage:: + + ./remove_old_snapshots.sh + +The script will check the expiration of the snapshots against their creation date and remove the snapshots which have expired. + + +crontab +------- Example crontab lines::