22 lines
662 B
Plaintext
22 lines
662 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [ "$1" == "" ]; then
|
||
|
echo "./upload.sh <source> <destination>"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ "$2" == "" ]; then
|
||
|
echo "./upload.sh <source> <destination>"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
nodes=$(terraform output -json -state=terraform/terraform.tfstate | jq -r '(.clients,.servers).value[]')
|
||
|
for node in $nodes
|
||
|
do
|
||
|
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"
|
||
|
done
|