#!/bin/bash
#curl -o wimermedia.com.zip http://jenkins.wimer.home/job/webback/lastSuccessfulBuild/artifact/gcp-backup.zip

cd terraform
./terraform init
./terraform plan -var "digitalocean_key=${DIGITALOCEAN_KEY}" -var "cloudflare_key=${CLOUDFLARE_KEY}" 
./terraform apply -var "digitalocean_key=${DIGITALOCEAN_KEY}" -var "cloudflare_key=${CLOUDFLARE_KEY}" -auto-approve -refresh=true

sleep 60s
cd ../ansible
pipenv install
pipenv run bash ansible-deploy.sh