Created
September 20, 2016 02:38
-
-
Save jason-callaway/66ba13b8607ca33cc647e7102a2dba99 to your computer and use it in GitHub Desktop.
Script for setting up the ansible-workshop deploy host's users
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
#!/bin/bash | |
for i in {1..40}; do | |
# Make the user | |
s="student${i}" | |
useradd -m ${s} | |
# Set up AWS CLI | |
mkdir -p ${s}/.aws | |
cp /root/.aws/* ${s}/.aws/ | |
cp ec2-user/ansible_workshop.pem ${s}/ | |
# Set up ssh | |
mkdir -p -m 0700 ${s}/.ssh | |
cp /home/config ${s}/.ssh/ | |
chmod 0600 ${s}/.ssh/config | |
# Set up the repo | |
cp -Rp /home/ansible-workshop ${s}/ansible-workshop | |
sed -i -e "s/changeme_workshop/${s}/" ${s}/ansible-workshop/group_vars/all.yml | |
# Fixup ownership | |
chown -R ${s}:${s} ${s} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment