2019-06-04 17:40:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$1" == "" ]; then
|
|
|
|
echo "./run.sh commands..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
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: ssh -i terraform/keys/*.pem ubuntu@"$node" "$@"
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new -i terraform/keys/*.pem ubuntu@"$node" "$@"
|
2019-06-04 19:52:32 +00:00
|
|
|
done
|