-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathcd.sh
More file actions
executable file
·23 lines (17 loc) · 1.03 KB
/
cd.sh
File metadata and controls
executable file
·23 lines (17 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
set -euo pipefail
# function cleanup {
# (cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform destroy -auto-approve)
# echo done
# }
# trap cleanup EXIT
(cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform init ; terraform apply -auto-approve )
adminhost=$(cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform output adminhost)
adminhost="${adminhost//\"/}" # remove extra quotes around the returned string
ssh_private_key=$(cd terraform/examples/wire-server-deploy-offline-hetzner ; terraform output ssh_private_key)
eval `ssh-agent`
ssh-add - <<< "$ssh_private_key"
ssh -oStrictHostKeyChecking=accept-new -oConnectionAttempts=10 "root@$adminhost" tar xzv < ./assets.tgz
(cd terraform/examples/wire-server-deploy-offline-hetzner; terraform output -json static-inventory)| ssh "root@$adminhost" tee ./ansible/inventory/offline/inventory.yml
# NOTE: Agent is forwarded; so that the adminhost can provision the other boxes
ssh -A "root@$adminhost" ./bin/offline-deploy.sh