Pull down script for s3
This commit is contained in:
parent
f87cc90d9e
commit
7f26b72190
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- hosts: webhost
|
||||||
|
remote_user: root
|
||||||
|
tasks:
|
||||||
|
- name: Copy pull script
|
||||||
|
copy:
|
||||||
|
src: ../scripts/pull-down-s3.sh
|
||||||
|
dest: /opt/nginx/pull-down-s3.sh
|
23
infra/static-vultr/ansible/scripts/pull-down-s3.sh
Normal file
23
infra/static-vultr/ansible/scripts/pull-down-s3.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
bucket="$1"
|
||||||
|
s3env=/opt/nginx/s3.env
|
||||||
|
|
||||||
|
[[ -z "$bucket" ]] && echo "No bucket selected" && exit 1
|
||||||
|
|
||||||
|
[[ ! -f $s3env ]] && echo "No credentials to source!" && exit 1
|
||||||
|
source $s3env
|
||||||
|
|
||||||
|
pull() {
|
||||||
|
aws s3 sync s3://$bucket /opt/nginx/$bucket
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case $bucket in
|
||||||
|
resume.shockrah.xyz|shockrah.xyz|temper.tv) pull;;
|
||||||
|
*) echo "Invalid bucket name" && exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user