add script restore
This commit is contained in:
parent
767c45eb30
commit
3b8652a97a
29
roles/deploy-web/files/scw-restore.sh
Normal file
29
roles/deploy-web/files/scw-restore.sh
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
echo -e "Usage $0 <scw_configrc> <time or delta> [file to restore] <restore to>
|
||||
Exemple:
|
||||
\t$ $0 2018-7-21 recovery/ ## recovers * from closest backup to date
|
||||
\t$ $0 0D secret data/ ## recovers most recent file nammed 'secret'";
|
||||
exit; fi
|
||||
|
||||
source $1
|
||||
shift
|
||||
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
duplicity \
|
||||
--s3-endpoint-url ${SCW_ENDPOINT_URL} \
|
||||
--s3-region-name ${SCW_REGION} \
|
||||
--time $1 \
|
||||
${SCW_BUCKET} $2
|
||||
fi
|
||||
|
||||
if [ $# -eq 3 ]; then
|
||||
duplicity \
|
||||
--s3-endpoint-url ${SCW_ENDPOINT_URL} \
|
||||
--s3-region-name ${SCW_REGION} \
|
||||
--time $1 \
|
||||
--file-to-restore $2 \
|
||||
${SCW_BUCKET} $3
|
||||
fi
|
@ -12,11 +12,14 @@
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: Copy scw backup script
|
||||
- name: Copy scw backup and restore script
|
||||
copy:
|
||||
src: "scw-backup.sh"
|
||||
dest: "/opt/scw-backup.sh"
|
||||
src: "{{ item }}"
|
||||
dest: "/opt/{{ item }}"
|
||||
mode: "0500"
|
||||
with_items:
|
||||
- "scw-backup.sh"
|
||||
- "scw-restore.sh"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
|
Loading…
x
Reference in New Issue
Block a user