Scripts et configurations

This commit is contained in:
Adrien Bourmault 2022-05-22 13:42:34 +02:00 committed by admin666
parent 480fa783d1
commit 9844ab07d3
4 changed files with 145 additions and 0 deletions

6
script_backups_aunt.sh Normal file
View File

@ -0,0 +1,6 @@
#! /bin/bash
echo "BACKUP SESSION $(date)" >> /var/log/backup.log
virt-backup backup 1>> /var/log/backup.log
virt-backup clean 1>> /var/log/backup.log

11
script_backups_mother.sh Normal file
View File

@ -0,0 +1,11 @@
#! /bin/bash
rsync -avcHS --exclude 'var/backups' --exclude 'opt' --exclude 'sys' --exclude 'proc' --exclude 'dev' --delete / /var/backups/mother 1>> /var/log/backup.log
rsync -avcHS --exclude 'var/backups' --exclude 'opt' --exclude 'sys' --exclude 'proc' --exclude 'dev' --delete aunt.onlink:/ /var/backups/aunt 1>> /var/log/backup.log
echo "BACKUP SESSION $(date)" >> /var/log/backup.log
virt-backup backup 1>> /var/log/backup.log
virt-backup clean 1>> /var/log/backup.log
#find /var/backups -type f -exec sudo fallocate -v -d {} \;

128
virt-backup_aunt.yml Normal file
View File

@ -0,0 +1,128 @@
---
########################
#### Global options ####
########################
## Be more verbose ##
debug: False
## How many threads (simultaneos backups) to run. Use 0 to use all CPU threads
## detected, 1 to disable multitheading for backups, or the number of threads
## wanted. Default: 1
threads: 0
############################
#### Libvirt connection ####
############################
## Libvirt URI ##
uri: "qemu+ssh://127.0.0.1:223/system"
## Libvirt authentication, if needed ##
username:
passphrase:
#######################
#### Backup groups ####
#######################
## Groups are here to share the same backup options between multiple domains.
## That way, it is possible, for example, to have a different policy retention
## for a pool of guests in testing than for the one in production.
## Define default options for all groups. ##
default:
hourly: 0
daily: 2
weekly: 2
monthly: 1
yearly: 0
## Groups definition ##
groups:
## Group name ##
aunt:
## Backup directory ##
target: /var/backups/vm/aunt
## Packager to use for each backup:
## directory: images will be copied as they are, in a directory per domain
## tar: images will be packaged in a tar file
## zstd: images will be compressed with zstd. Requires python "zstandard" package to be installed.
packager: directory
## Options for the choosen packager:
#tar:
## # Compression algorithm to use. Default to None.
# compression: "xz"
#None | "xz" | "gz" | "bz2"
## # Compression level to use for each backup.
## # Generally this should be an integer between 1~9 (depends on the
## # compression algorithm), where 1 will be the fastest while having
## # the lowest compression ratio, and 9 gives the best compression ratio
## # but takes the longest time to compress.
# compression_lvl: 5
##
## zstd:
## # Compression level to use for each backup.
## # 1 will be the fastest while having the lowest compression ratio,
## # and 22 gives the best compression ratio but takes the longest time
## # to compress.
## compression_lvl: [1-22]
#packager_opts:
# compression: xz
# compression_lvl: 6
## When doing `virt-backup backup` without specifying any group, only
## groups with the autostart option enabled will be backup.
autostart: True
## Retention policy: the first backup of the day is considered as the
## "daily" backup, first of the week "weekly", etc. The following options
## detail how many backups of each type has to be kept. Set to "*" or None for an
## infinite retention.
## Default to 5 for everything, meaning that calling "virt-backup clean" will let 5
## backups for each period not specified in the config.
hourly: 0
daily: 2
weekly: 2
monthly: 1
yearly: 0
## Enable the Libvirt Quiesce option when taking the external snapshots.
##
## From Libvirt documentation: libvirt will try to freeze and unfreeze the guest
## virtual machines mounted file system(s), using the guest agent. However, if the
## guest virtual machine does not have a guest agent, snapshot creation will fail.
##
## However, virt-backup has a fallback mechanism if the snapshot happens to fail
## with Quiesce enabled, and retries without it.
quiesce: False
## Hosts definition ##
hosts:
## This policy will match the domain "domainname" in libvirt, and will
## backup the disks "vba" and "vdb" only.
#- host: domainname
# disks:
# - vda
# - vdb
## Quiesce option can also be overriden per host definition.
# quiesce: False
## Will backup all disks of "domainname2" ##
#- domainname2
## Regex that will match for all domains starting with "prod". The regex
## syntax is the same as the python one
- host: "r:.*"
# disks:
# - vda
## Exclude the domain domainname3 (useful with regex, for example)
#- "!domainname3"
## Exclude all domains starting with "test"
- "!r:^generic.*"
# vim: set ts=2 sw=2: