forked from elastic/elasticsearch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in dev/can/gen-student-access-vladimiar-andre (pull request el…
…astic#212) Allow Vladimir and Andre to access the generators as themselves Approved-by: Andre Sodermans
- Loading branch information
Can Yildiz
committed
Aug 26, 2021
1 parent
15fc2ef
commit b287337
Showing
1 changed file
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
#!/bin/bash | ||
AWS_REGION="us-west-2" | ||
set -x | ||
# Usage: Authenticate for aws cli, run: prep_generators.sh <AWS_REGION>, argument is optional and defaults to us-west-2 | ||
cd "$(dirname "$0")" | ||
AWS_REGION="${1:-us-west-2}" | ||
IPS=($(aws ec2 describe-instances --region "${AWS_REGION}" --filters Name=tag:Role,Values=gen-student --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)) | ||
USERS=(cany serge gideon matan warren marlon) | ||
USERS=(cany serge gideon matan warren marlon vladimir andre) | ||
for IP in "${IPS[@]}"; do | ||
echo "Working on $IP" | ||
scp -o "StrictHostKeyChecking=no" "/other/pet/utils/gen_students/gen_students.js" "ubuntu@${IP}:/home/ubuntu" | ||
if [[ -f "../../pet/utils/gen_students/gen_students.js" ]]; then | ||
echo "Copying gen_students.js from local repo to generator" | ||
scp -o "StrictHostKeyChecking=no" "../../../pet/utils/gen_students/gen_students.js" "ubuntu@${IP}:/home/ubuntu" | ||
fi | ||
for user in "${USERS[@]}"; do | ||
fab -H "ubuntu@${IP}" add-user -u "${user}" -p "/other/devops/aws/ssh-public-keys/${user}.pub" | ||
fab -H "ubuntu@${IP}" add-user -u "${user}" -p "../ssh-public-keys/${user}.pub" | ||
done | ||
done |