Actualiser Backup_OpenStack_Vms_And_Volumes.sh
This commit is contained in:
parent
64836447f2
commit
dfd649678c
1 changed files with 19 additions and 16 deletions
|
@ -1,20 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#source openrc.sh
|
#source openrc.sh
|
||||||
#export OS_AUTH_TYPE=v3applicationcredential
|
export OS_AUTH_TYPE=v3applicationcredential
|
||||||
#export OS_AUTH_URL=https://auth.cloud.ovh.net/
|
export OS_AUTH_URL=https://auth.cloud.ovh.net/
|
||||||
#export OS_IDENTITY_API_VERSION=3
|
export OS_IDENTITY_API_VERSION=3
|
||||||
#export OS_INTERFACE=public
|
export OS_INTERFACE=public
|
||||||
#export OS_REGION_NAME="GRA11"
|
export OS_REGION_NAME="GRA11"
|
||||||
#export OS_APPLICATION_CREDENTIAL_ID=
|
export OS_APPLICATION_CREDENTIAL_ID=
|
||||||
#export OS_APPLICATION_CREDENTIAL_SECRET=
|
export OS_APPLICATION_CREDENTIAL_SECRET=
|
||||||
|
export PROJECT_ID=
|
||||||
|
|
||||||
#Daily Retention (Nb of months)
|
#Daily Retention (Nb of months)
|
||||||
export DAILY_RETENTION=7
|
export DAILY_RETENTION=20
|
||||||
|
|
||||||
#Monthly Retention (Nb of months)
|
#Monthly Retention (Nb of months)
|
||||||
# 0 = disable monthly backup
|
# 0 = disable monthly backup
|
||||||
export MONTHLY_RETENTION=0
|
export MONTHLY_RETENTION=12
|
||||||
# DAY OF MOUNTH TO EXECUTE MONTHLY BACKUP
|
# DAY OF MOUNTH TO EXECUTE MONTHLY BACKUP
|
||||||
# 01 ... 30 31
|
# 01 ... 30 31
|
||||||
export DAY_MONTHLY_BACKUP=01
|
export DAY_MONTHLY_BACKUP=01
|
||||||
|
@ -29,6 +30,9 @@ export DAY_OF_YEARLY_BACKUP=01
|
||||||
# 01:january... 12:December
|
# 01:january... 12:December
|
||||||
export MONTH_OF_YEARLY_BACKUP=01
|
export MONTH_OF_YEARLY_BACKUP=01
|
||||||
|
|
||||||
|
# Number of backup instances to keep
|
||||||
|
export MAX_KEEP_BACKUP_INSTANCES=100
|
||||||
|
|
||||||
#Set TimeZone
|
#Set TimeZone
|
||||||
export TZ=Europe/Paris
|
export TZ=Europe/Paris
|
||||||
|
|
||||||
|
@ -166,7 +170,7 @@ function backup(){
|
||||||
|
|
||||||
_info_action " ------> [Instance : ${SERVER}] ---> Launching the Snapshot of the instance ${SERVER} to ${BCK_SERVER}"
|
_info_action " ------> [Instance : ${SERVER}] ---> Launching the Snapshot of the instance ${SERVER} to ${BCK_SERVER}"
|
||||||
BCK_INSTANCES_LIST+=(${BCK_SERVER})
|
BCK_INSTANCES_LIST+=(${BCK_SERVER})
|
||||||
${OPENSTACK} server backup create --name ${BCK_SERVER} ${SERVER}
|
${OPENSTACK} server backup create --rotate ${MAX_KEEP_BACKUP_INSTANCES} --name ${BCK_SERVER} ${SERVER}
|
||||||
|
|
||||||
_info_blue " ------> [Instance : ${SERVER}] === === End of the backup === ==="
|
_info_blue " ------> [Instance : ${SERVER}] === === End of the backup === ==="
|
||||||
done
|
done
|
||||||
|
@ -349,7 +353,7 @@ function manage_retention(){
|
||||||
function job_details(){
|
function job_details(){
|
||||||
_info_blue "#######################################################################################"
|
_info_blue "#######################################################################################"
|
||||||
_info_blue "Starting Backup Job "
|
_info_blue "Starting Backup Job "
|
||||||
PJT_DESC=$(${OPENSTACK} project show ${OS_TENANT_ID} -f json | ${JQ} -r '.description')
|
PJT_DESC=$(${OPENSTACK} project show ${PROJECT_ID} -f json | ${JQ} -r '.description')
|
||||||
_info_blue " ---> Project Description : ${PJT_DESC}"
|
_info_blue " ---> Project Description : ${PJT_DESC}"
|
||||||
_info_blue " ---> Region : ${OS_REGION_NAME}"
|
_info_blue " ---> Region : ${OS_REGION_NAME}"
|
||||||
|
|
||||||
|
@ -402,7 +406,6 @@ function _warning(){
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
job_details
|
job_details
|
||||||
exit
|
|
||||||
check_prerequistes
|
check_prerequistes
|
||||||
backup
|
backup
|
||||||
check_backup
|
check_backup
|
||||||
|
|
Loading…
Reference in a new issue