dsfg
All checks were successful
ansible-lint / gitleaks (pull_request) Successful in 2s
ansible-lint / Ansible Lint (pull_request) Successful in 24s

This commit is contained in:
Michael Grote 2024-10-29 15:58:51 +01:00
parent 9dd59bf76e
commit 555d483ae0
2 changed files with 32 additions and 32 deletions

View file

@ -233,30 +233,30 @@ pve_pbs_datastore:
fingerprint: "7F:AC:54:75:1C:33:55:84:1E:1E:3A:15:5A:5E:AF:79:33:C9:D4:E1:C0:A0:1C:0D:9E:6A:EA:82:F9:27:57:79"
### mgrote_sync
rsync_mirror_dirs: # "/" beachten, bei Src+Dest "/" am Ende
- src: /hdd_data/tmp/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/tmp/"
- src: hdd_data/archiv/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/archiv/"
- src: hdd_data/backup/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/backup/"
- src: hdd_data/bilder/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/bilder/"
- src: hdd_data/buecher/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/buecher/"
- src: hdd_data/music/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/music/"
- src: hdd_data/programme/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/programme/"
- src: hdd_data/pve_backup/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/pve_backup/"
- src: hdd_data/restic/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/restic/"
- src: hdd_data/scans/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/scans/"
- src: hdd_data/tmp/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/tmp/"
- src: hdd_data/videos/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/videos/"
- src: hdd_data/vm/
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/vm/"
rsync_mirror_dirs: # "/" beachten, bei Src+Dest "/" KEIN am Ende
- src: /hdd_data/tmp
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/tmp"
- src: hdd_data/archiv
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/archiv"
- src: hdd_data/backup
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/backup"
- src: hdd_data/bilder
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/bilder"
- src: hdd_data/buecher
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/buecher"
- src: hdd_data/music
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/music"
- src: hdd_data/programme
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/programme"
- src: hdd_data/pve_backup
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/pve_backup"
- src: hdd_data/restic
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/restic"
- src: hdd_data/scans
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/scans"
- src: hdd_data/tmp
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/tmp"
- src: hdd_data/videos
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/videos"
- src: hdd_data/vm
dest: "{{ rsync_mirror_user }}@pbs.mgrote.net:/backup/pve5/vm"

View file

@ -4,13 +4,13 @@
{% for item in rsync_mirror_dirs %}
{# Header #}
echo "-----------------------"
echo "Source: {{ item.src | regex_replace('\\/$', '') }}"
echo "Destination: {{ item.dest.split(':') | last | regex_replace('\\/$', '') }}"
echo "Source: {{ item.src }}"
echo "Destination: {{ item.dest.split(':') | last }}"
{# Mount check source #}
if /usr/sbin/zfs get mounted -H {{ item.src | regex_replace('\\/$', '') }} 2>&1 > /dev/null ; then
if /usr/sbin/zfs get mounted -H {{ item.src }} 2>&1 > /dev/null ; then
{# Mount check destination #}
if [[ "$(ssh -i /etc/rsync_mirror/.ssh/id_rsync_mirror -o StrictHostKeyChecking=no {{ item.dest.split(':') | first }} /usr/sbin/zfs get mounted -H {{ item.dest.split(':') | last | regex_replace('\\/$', '') }} | cut -f3)" -eq "yes" ]] ; then
rsync -e "ssh -i /etc/rsync_mirror/.ssh/id_rsync_mirror -o StrictHostKeyChecking=no" --dry-run --bwlimit={{ rsync_mirror_bw_limit }} --archive --verbose --itemize-changes --omit-dir-times --human-readable --stats --compress --fuzzy --force --delete-after --recursive {{ item.src }} {{ item.dest }}
if [[ "$(ssh -i /etc/rsync_mirror/.ssh/id_rsync_mirror -o StrictHostKeyChecking=no {{ item.dest.split(':') | first }} /usr/sbin/zfs get mounted -H {{ item.dest.split(':') | last }} | cut -f3)" -eq "yes" ]] ; then
rsync -e "ssh -i /etc/rsync_mirror/.ssh/id_rsync_mirror -o StrictHostKeyChecking=no" --dry-run --bwlimit={{ rsync_mirror_bw_limit }} --archive --verbose --itemize-changes --omit-dir-times --human-readable --stats --compress --fuzzy --force --delete-after --recursive {{ item.src }}/ {{ item.dest }}/ {# "/" am Ende von Src+Dest ist Wichtig und notwendig, sonst wird in Unterordner kopiert }
else
echo "Destination-Dataset not mounted!"
fi