Skip to content

Commit

Permalink
Merged in dev/can/gen-student-access-vladimiar-andre (pull request el…
Browse files Browse the repository at this point in the history
…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.
14 changes: 10 additions & 4 deletions aws/gen-students-tf/prep_generators.sh
@@ -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

0 comments on commit b287337

Please sign in to comment.