Adding exclude dirs and post-backup tasks
This commit is contained in:
parent
4e2f4bf3fe
commit
8cfe198f7e
@ -10,6 +10,8 @@ borgbackup_download_url: "https://github.com/borgbackup/borg/releases/download/{
|
||||
borgbackup_pre_commands:
|
||||
- '[[ ! -f "/usr/sbin/automysqlbackup" ]] || /usr/sbin/automysqlbackup'
|
||||
|
||||
borgbackup_post_commands: []
|
||||
|
||||
borgbackup_include:
|
||||
- "/etc"
|
||||
- "/home"
|
||||
@ -17,6 +19,8 @@ borgbackup_include:
|
||||
- "/var/www"
|
||||
- "/var/log"
|
||||
|
||||
borgbackup_exclude: []
|
||||
|
||||
borgbackup_retention:
|
||||
hourly: 12
|
||||
daily: 7
|
||||
|
@ -66,7 +66,7 @@ if [ "$1" = "backup" ]
|
||||
printf "Backing up to {{ b.fqdn }} :\n"
|
||||
REPOSITORY={% if b.type == 'hetzner' %}ssh://{% endif %}{{ b.user }}@{{ b.fqdn }}:{% if b.type == 'hetzner' %}23/./{% endif %}{{ b.home }}{{ b.pool }}/{{ inventory_hostname }}
|
||||
|
||||
/usr/local/bin/borg create --compression zlib,6 --stats $REPOSITORY::$date {{ b.options }} {% for dir in borgbackup_include %}{{ dir }} {% endfor %}{% if automysql.stat.isdir is defined and automysql.stat.isdir == True %}/var/lib/automysqlbackup{% endif %}
|
||||
/usr/local/bin/borg create -p --compression zlib,6 --stats $REPOSITORY::$date {{ b.options }} {% for dir in borgbackup_include %}{{ dir }} {% endfor %}{% if automysql.stat.isdir is defined and automysql.stat.isdir == True %}/var/lib/automysqlbackup{% endif %} {% for dir in borgbackup_exclude %} --exclude '{{ dir }}'{% endfor %}
|
||||
|
||||
if [ "$?" -eq "0" ]; then printf "Backup succeeded on $date to {{ b.fqdn }}\n" >> /var/log/borg-backup.log; fi
|
||||
|
||||
@ -75,5 +75,11 @@ if [ "$1" = "backup" ]
|
||||
/usr/local/bin/borg prune -v $REPOSITORY {{ b.options }} -H {{ borgbackup_retention.hourly }} -d {{ borgbackup_retention.daily }} -w {{ borgbackup_retention.weekly }} -m {{ borgbackup_retention.monthly }} -y {{ borgbackup_retention.yearly }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
# Running some commands post-backup
|
||||
{% for postcommand in borgbackup_post_commands %}
|
||||
{{ postcommand }}
|
||||
{% endfor %}
|
||||
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user