diff --git a/inventory/host_vars/vps-host b/inventory/host_vars/vps-host index 628dc84..b10ad15 100644 --- a/inventory/host_vars/vps-host +++ b/inventory/host_vars/vps-host @@ -1,30 +1,30 @@ $ANSIBLE_VAULT;1.1;AES256 -36626136326337616132316236306132333431646431313930313833313062336239623763336335 -6538653435663965303330303835353935636433303834340a326439353435326661343964623464 -61633563323032626230616361336533313733363965323666306537313061666266613731366430 -6464306365656536300a303463313966353833346164326434376635326334336539393739383266 -66383664636161656636623131636437646436316530376133616134383732633932623064663531 -30306135643033633934396530353636653263393935613230663165623664653563306161383761 -36653533326264346134623532363562313638666439626163396466316632303866306664363666 -35613064616236316532643235643231376564616530363831386436626565363261636438663335 -35303233303734653363613161363036393434626363333636613331316133366462316665626463 -62343762643233343366396439303966333331663865636666643230333937653866666432353162 -35306131623364306131333931326437646335653237653735663165656132303065656162653539 -63326337306234333636373461326537376561353663343231336561313736363432376261656566 -63366261353539646263343366363533623330393132373461373166323633333032303930616134 -33663365356430373239663462343135636138373831626633383664333135353466636439316638 -64313138326630613233323461653730323733353465356433626436336338633431656334363366 -31376566653565643631383339326465303537633864343136623230366630376539383465303639 -32626562373062313464323037323530346530303235313037663236646134626434363934643935 -66626333363163306563316631313331656261353263633133393835303235626665376236333339 -32323366653932393666313164643162363864636238613332343263623731643338303066326364 -66626163343733646462626536336533353239383332616438316565353966373263356336653062 -34646432396264666461336534363862623230313633336434393065303863623338326135363365 -65363733656339616461363564646633626462643062343835663637633832646633353664653933 -39393838333332616665663432626565336235396138316637663933373339613336376164376166 -36626261366331336436353466623230326232373833333038313138623366623234363630303663 -30646537653230383461623535376631613337336539626166653236373961326639326232393264 -31306336303563383734376366383831663061373532336636626165336335653465373839363235 -37393132613461656263386537376634363661393038626264373435366366336135383132303733 -36653862393932393734303862666463376138303635363161333566323830343336336566666230 -37626136376231353566313934633563656636356430663861336537613664306461 +33636162336330363833666465326430326230353032643365623263306139346138363135316462 +6232623366616434333833333630663435333237306563630a333065363335653361613135316131 +38346464653533633062636534303937366534383064376232336635663665323163386566336465 +3037636164626361390a373963346334616232323639353561306631333834613964363635626330 +62633139383230373063313136383534653230323038313762323430393164616534363836376333 +30303662613534333631393031303165376435363831323636316561336530393963313465356164 +37386462643361363265326230393465313536343533646437393634663663663862643033323966 +34396162613134343738343861666663643338363136383262666263623933316435323135656331 +30373134376565633662646365636464663562636666303061653664633138326139373737303163 +30613561366233333264336562633837393239626462633238323564386332613861323266643733 +37653764646637313631326365373935313762393934663234326362393762313434663366663165 +62313036373732383739666166626631353738323830636234383430313539666433643139346232 +39626462613537363263343166663038346338383863343334656433396238346330653938373139 +39373265373961303763613962353762303735323966373762616462643433353162623136656130 +34666362373638303635313833663133623431353230386266653962646163646665333334646661 +38663634346461663430623235623138666563343739643432366635653331663233366136353666 +35393765346362663561633064356364623737353862353334386638306362363362386663663636 +37663731356664396330663862623965343237643066663031336338313937363461343264633534 +39613230373964663462656664656161623939656361336532383530303030666264323439623231 +65643430643433643239333338646363343933373934353435646337333238663239613539333862 +33333130386239303738366262386562323261653334356238646132313861396661633937353630 +65643064383036623035313766346636636264653265666232343837343033646466623066663932 +37313366363064613662383938663965633865326333323264363730666635316533393331643362 +64373661303761633862613237363430346134346237633736326139363963656239393162616432 +31663437333434626536353164663234353164623265623538303031333833646438616265306633 +38346535366531323032313232656533613431313133373561343465616266306634656237333038 +65633134656132623238363136623934346235316336326136613863626564396339646265323262 +65313239353737656231383664656431343239363730666362376532663835643337666664393738 +6131 diff --git a/playbook.yml b/playbook.yml index 47c229a..a5d892b 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,5 +1,5 @@ --- - hosts: all - remote_user: admloc + remote_user: valentin roles: - deploy-web diff --git a/roles/deploy-web/files/scw-backup.sh b/roles/deploy-web/files/scw-backup.sh index 1bf2635..3c394b9 100755 --- a/roles/deploy-web/files/scw-backup.sh +++ b/roles/deploy-web/files/scw-backup.sh @@ -10,7 +10,7 @@ log () { rotate_log() { 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" if [ $(grep "Errors 0" ${LOGFILE_RECENT} |wc -l) -eq 0 ]; then status="ALERTE FAIL !!!" @@ -35,15 +35,17 @@ if [ $currently_backuping -eq 0 ]; then source "$1" echo > ${LOGFILE_RECENT} 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}" ${DUPLICITY} \ incr --full-if-older-than ${FULL_BACKUP_TIME} \ + --s3-endpoint-url ${SCW_ENDPOINT_URL} \ + --s3-region-name ${SCW_REGION} \ --asynchronous-upload \ --s3-use-glacier \ --encrypt-key=${GPG_FINGERPRINT} \ --sign-key=${GPG_FINGERPRINT} \ - ${SOURCE} ${URL_SCW} >> ${LOGFILE_RECENT} 2>&1 + ${SOURCE} ${SCW_BUCKET} >> ${LOGFILE_RECENT} 2>&1 rotate_log else log ">>> Duplicity déjà en cours de route sur cette utilisateur ${USER}" diff --git a/roles/deploy-web/templates/scw-configrc.j2 b/roles/deploy-web/templates/scw-configrc.j2 index 32db50f..8fa877f 100644 --- a/roles/deploy-web/templates/scw-configrc.j2 +++ b/roles/deploy-web/templates/scw-configrc.j2 @@ -1,6 +1,8 @@ export AWS_ACCESS_KEY_ID="{{ aws_access_key_id }}" 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 export PASSPHRASE="{{ passphrase }}"