From c97eb91da98c6d41bcbdc0f332d4b820b8423408 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Tue, 14 Jan 2025 17:34:47 +0600 Subject: [PATCH] a draft for copying file from backup to staging --- infrastructure/server-setup/backups.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/infrastructure/server-setup/backups.yml b/infrastructure/server-setup/backups.yml index 23ab3c3c3..e723c4937 100644 --- a/infrastructure/server-setup/backups.yml +++ b/infrastructure/server-setup/backups.yml @@ -185,15 +185,14 @@ remote_user: '{{ crontab_user }}' register: rsync_test when: "'backups' in groups and groups['backups'] | length > 0" - ignore_errors: yes tags: - backups - - - name: Fail if rsync test failed - fail: - msg: 'rsync to the backup server failed' - when: "'backups' in groups and groups['backups'] | length > 0 and rsync_test.rc != 0" + + - name: Check if file can be transferred to the staging server from backup server + shell: ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 {{ backup_server_user }}@{{ destination_server }} 'rsync -avz -e "ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5" {{ backup_server_remote_target_directory }}/test_file.txt {{ crontab_user }}@{{ inventory_hostname }}:/tmp/test_file.txt' + remote_user: '{{ crontab_user }}' + register: rsync_test_from_backup + when: "'backups' in groups and groups['backups'] | length > 0 and backup_restore_encryption_passphrase and periodic_restore_from_backup" tags: - backups - - \ No newline at end of file + \ No newline at end of file