Created
September 8, 2020 22:13
-
-
Save brianwhigham/74adeb6b7b0a8b3a02d50c4ece3fe9ad to your computer and use it in GitHub Desktop.
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 | |
PKGS="git swift ansible" | |
PKGMGR=yum | |
REPONAME=uat-swiftstack | |
REPOOWNER=encompassdigitalmedia | |
SWIFTRC=/etc/swiftrc-uat-swiftstack | |
grep "^ID=" /etc/os-release | grep ubuntu && PKGMGR=apt | |
# set swift credentials in order to download our SSH deploy key | |
read -p "Please enter the EDMTest Swift password: " ST_KEY | |
ST_USER=EDMTest | |
ST_AUTH=https://us-east.mediastorage.tatamediaservices.com/auth/v1.0 >> | |
sudo cat << EOF > $SWIFTRC | |
ST_KEY=$ST_KEY | |
ST_USER=$ST_USER | |
ST_AUTH=$ST_AUTH | |
EOF | |
# configure SSH to connect to github | |
sudo grep github /root/.ssh/config || { | |
sudo echo "Host github.com" >> /root/.ssh/config | |
sudo echo " User git" >> /root/.ssh/config | |
sudo echo " IdentityFile /root/.ssh/id_rsa_uat_swiftstack" >> /root/.ssh/config | |
} | |
# prepare spot for our SSH deploy key | |
sudo mkdir /root/.ssh | |
sudo chmod 700 /root/.ssh | |
# fetch the SSH deploy key from SwiftStack | |
sudo swift download -o /root/.ssh/id_rsa_uat_swiftstack edm-conf-uat-swiftstack common/id_rsa_uat_swiftstack | |
# install packages | |
sudo $PKGMGR install -y $PKGS | |
# download the UAT repo | |
sudo git clone -i /root/.ssh/id_rsa_uat_swiftstack [email protected]:$REPOOWNER/$REPONAME.git /root/$REPONAME | |
# run the playbook | |
sudo ansible-playbook /root/uat-swiftstack/deploy/playbook.yaml | |
echo All done with the base configuration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment