fix script backup for new version duplicity

This commit is contained in:
Valentin CZERYBA 2023-02-27 22:31:21 +01:00
parent 85f7573262
commit 767c45eb30
4 changed files with 38 additions and 34 deletions

View File

@ -1,30 +1,30 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
36626136326337616132316236306132333431646431313930313833313062336239623763336335 33636162336330363833666465326430326230353032643365623263306139346138363135316462
6538653435663965303330303835353935636433303834340a326439353435326661343964623464 6232623366616434333833333630663435333237306563630a333065363335653361613135316131
61633563323032626230616361336533313733363965323666306537313061666266613731366430 38346464653533633062636534303937366534383064376232336635663665323163386566336465
6464306365656536300a303463313966353833346164326434376635326334336539393739383266 3037636164626361390a373963346334616232323639353561306631333834613964363635626330
66383664636161656636623131636437646436316530376133616134383732633932623064663531 62633139383230373063313136383534653230323038313762323430393164616534363836376333
30306135643033633934396530353636653263393935613230663165623664653563306161383761 30303662613534333631393031303165376435363831323636316561336530393963313465356164
36653533326264346134623532363562313638666439626163396466316632303866306664363666 37386462643361363265326230393465313536343533646437393634663663663862643033323966
35613064616236316532643235643231376564616530363831386436626565363261636438663335 34396162613134343738343861666663643338363136383262666263623933316435323135656331
35303233303734653363613161363036393434626363333636613331316133366462316665626463 30373134376565633662646365636464663562636666303061653664633138326139373737303163
62343762643233343366396439303966333331663865636666643230333937653866666432353162 30613561366233333264336562633837393239626462633238323564386332613861323266643733
35306131623364306131333931326437646335653237653735663165656132303065656162653539 37653764646637313631326365373935313762393934663234326362393762313434663366663165
63326337306234333636373461326537376561353663343231336561313736363432376261656566 62313036373732383739666166626631353738323830636234383430313539666433643139346232
63366261353539646263343366363533623330393132373461373166323633333032303930616134 39626462613537363263343166663038346338383863343334656433396238346330653938373139
33663365356430373239663462343135636138373831626633383664333135353466636439316638 39373265373961303763613962353762303735323966373762616462643433353162623136656130
64313138326630613233323461653730323733353465356433626436336338633431656334363366 34666362373638303635313833663133623431353230386266653962646163646665333334646661
31376566653565643631383339326465303537633864343136623230366630376539383465303639 38663634346461663430623235623138666563343739643432366635653331663233366136353666
32626562373062313464323037323530346530303235313037663236646134626434363934643935 35393765346362663561633064356364623737353862353334386638306362363362386663663636
66626333363163306563316631313331656261353263633133393835303235626665376236333339 37663731356664396330663862623965343237643066663031336338313937363461343264633534
32323366653932393666313164643162363864636238613332343263623731643338303066326364 39613230373964663462656664656161623939656361336532383530303030666264323439623231
66626163343733646462626536336533353239383332616438316565353966373263356336653062 65643430643433643239333338646363343933373934353435646337333238663239613539333862
34646432396264666461336534363862623230313633336434393065303863623338326135363365 33333130386239303738366262386562323261653334356238646132313861396661633937353630
65363733656339616461363564646633626462643062343835663637633832646633353664653933 65643064383036623035313766346636636264653265666232343837343033646466623066663932
39393838333332616665663432626565336235396138316637663933373339613336376164376166 37313366363064613662383938663965633865326333323264363730666635316533393331643362
36626261366331336436353466623230326232373833333038313138623366623234363630303663 64373661303761633862613237363430346134346237633736326139363963656239393162616432
30646537653230383461623535376631613337336539626166653236373961326639326232393264 31663437333434626536353164663234353164623265623538303031333833646438616265306633
31306336303563383734376366383831663061373532336636626165336335653465373839363235 38346535366531323032313232656533613431313133373561343465616266306634656237333038
37393132613461656263386537376634363661393038626264373435366366336135383132303733 65633134656132623238363136623934346235316336326136613863626564396339646265323262
36653862393932393734303862666463376138303635363161333566323830343336336566666230 65313239353737656231383664656431343239363730666362376532663835643337666664393738
37626136376231353566313934633563656636356430663861336537613664306461 6131

View File

@ -1,5 +1,5 @@
--- ---
- hosts: all - hosts: all
remote_user: admloc remote_user: valentin
roles: roles:
- deploy-web - deploy-web

View File

@ -10,7 +10,7 @@ log () {
rotate_log() { rotate_log() {
cat ${LOGFILE_RECENT} >> ${LOGFILE} cat ${LOGFILE_RECENT} >> ${LOGFILE}
backupScw=`echo ${URL_SCW} | rev | cut -d "/" -f 2 | rev` backupScw=`echo ${SCW_BUCKET} | rev | cut -d "/" -f 2 | rev`
status="OK" status="OK"
if [ $(grep "Errors 0" ${LOGFILE_RECENT} |wc -l) -eq 0 ]; then if [ $(grep "Errors 0" ${LOGFILE_RECENT} |wc -l) -eq 0 ]; then
status="ALERTE FAIL !!!" status="ALERTE FAIL !!!"
@ -35,15 +35,17 @@ if [ $currently_backuping -eq 0 ]; then
source "$1" source "$1"
echo > ${LOGFILE_RECENT} echo > ${LOGFILE_RECENT}
log ">>> removing old backups" log ">>> removing old backups"
${DUPLICITY} remove-older-than ${KEEP_BACKUP_TIME} ${URL_SCW} --force >> ${LOGFILE_RECENT} 2>&1 ${DUPLICITY} remove-older-than --s3-endpoint-url ${SCW_ENDPOINT_URL} --s3-region-name ${SCW_REGION} ${KEEP_BACKUP_TIME} ${SCW_BUCKET} --force >> ${LOGFILE_RECENT} 2>&1
log ">>> creating and uploading backup to c14 cold storage ${SOURCE}" log ">>> creating and uploading backup to c14 cold storage ${SOURCE}"
${DUPLICITY} \ ${DUPLICITY} \
incr --full-if-older-than ${FULL_BACKUP_TIME} \ incr --full-if-older-than ${FULL_BACKUP_TIME} \
--s3-endpoint-url ${SCW_ENDPOINT_URL} \
--s3-region-name ${SCW_REGION} \
--asynchronous-upload \ --asynchronous-upload \
--s3-use-glacier \ --s3-use-glacier \
--encrypt-key=${GPG_FINGERPRINT} \ --encrypt-key=${GPG_FINGERPRINT} \
--sign-key=${GPG_FINGERPRINT} \ --sign-key=${GPG_FINGERPRINT} \
${SOURCE} ${URL_SCW} >> ${LOGFILE_RECENT} 2>&1 ${SOURCE} ${SCW_BUCKET} >> ${LOGFILE_RECENT} 2>&1
rotate_log rotate_log
else else
log ">>> Duplicity déjà en cours de route sur cette utilisateur ${USER}" log ">>> Duplicity déjà en cours de route sur cette utilisateur ${USER}"

View File

@ -1,6 +1,8 @@
export AWS_ACCESS_KEY_ID="{{ aws_access_key_id }}" export AWS_ACCESS_KEY_ID="{{ aws_access_key_id }}"
export AWS_SECRET_ACCESS_KEY="{{ aws_secret_access_key }}" export AWS_SECRET_ACCESS_KEY="{{ aws_secret_access_key }}"
export URL_SCW="s3://{{ url_scw }}/{{ scw_directory }}" export SCW_REGION="{{ scw_region }}"
export SCW_ENDPOINT_URL="https://s3.${SCW_REGION}.scw.cloud"
export SCW_BUCKET="s3://{{ scw_directory }}"
# GPG Key information # GPG Key information
export PASSPHRASE="{{ passphrase }}" export PASSPHRASE="{{ passphrase }}"