[fix] the management station should work

This commit is contained in:
root 2019-09-26 21:08:04 +00:00
parent 23609395dc
commit 5ac24196dc
4 changed files with 43 additions and 17 deletions

View file

@ -0,0 +1,12 @@
#! /bin/bash
echo "Host: {{ item }}"
export BORG_PASSPHRASE={{ hostvars[item].borgbackup_passphrase }}
{% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ item }}
{% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ item }}
{% endif %}
/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 }}
dzadza
{% endfor %}

View file

@ -16,20 +16,5 @@ LOG_DIR=/var/log/borgbackup
LOG_FILE=/var/log/borgbackup-prune/${DATE}.log
exec &> >(tee "$LOG_FILE")
{% for h in groups['all'] %}
{% if h != borgbackup_management_station and h not in groups['borgbackup_servers'] -%}
echo "Host: {{ h }}"
export BORG_PASSPHRASE={{ hostvars[h].borgbackup_passphrase }}
{% if borgbackup_management_station is defined and inventory_hostname == borgbackup_management_station %}
{% for b in borgbackup_servers %}
{% if b.type == 'hetzner' %}
REPOSITORY=ssh://{{ b.user }}@{{ b.fqdn }}:23/./{{ b.home }}{{ b.pool }}/{{ h }}
{% else %}
REPOSITORY={{ b.user }}@{{ b.fqdn }}:{{ b.home }}{{ b.pool }}/{{ h }}
{% endif %}
/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 }}
run-parts --lsbsysinit ~{{ borgbackup_management_user }}/prune.d
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}