2022-04-12 14:08:21 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-06-04 17:40:46 +00:00
|
|
|
|
2019-06-04 19:52:32 +00:00
|
|
|
if [ $# -ne 2 ]; then
|
2019-06-04 17:40:46 +00:00
|
|
|
echo "./upload.sh <source> <destination>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-06-04 19:52:32 +00:00
|
|
|
set -e
|
2019-06-04 17:40:46 +00:00
|
|
|
|
2020-07-24 14:52:12 +00:00
|
|
|
nodes=$(terraform output -json -state=terraform/terraform.tfstate | jq -r '(.linux_clients,.servers).value[]')
|
2019-06-04 17:40:46 +00:00
|
|
|
for node in $nodes
|
|
|
|
do
|
2020-07-24 14:52:12 +00:00
|
|
|
echo Executing: scp -C -i terraform/keys/*.pem "$1" ubuntu@"$node":"$2"
|
|
|
|
# scp -o StrictHostKeyChecking=accept-new -C -i terraform/keys/*.pem "$1" ubuntu@"$node":"$2"
|
|
|
|
scp -o StrictHostKeyChecking=accept-new -C -i terraform/keys/*.pem "$1" ubuntu@"$node":/tmp/uploaded
|
|
|
|
ssh -i terraform/keys/*.pem ubuntu@"$node" sudo mv /tmp/uploaded "$2"
|
2019-06-04 19:52:32 +00:00
|
|
|
done
|