Skip to content

Instantly share code, notes, and snippets.

@psoliver92
Created September 26, 2018 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psoliver92/dac4d96451cdd998834dd8e4b4f56ece to your computer and use it in GitHub Desktop.
Save psoliver92/dac4d96451cdd998834dd8e4b4f56ece to your computer and use it in GitHub Desktop.
Lambda deploy EC2 script init
"""#!/bin/bash
apt-get update
apt-get install git -qq -y
apt-get install python3.4-venv
cat > /home/id_rsa <<EOF
""" + id_rsa + """
EOF
chmod 600 /home/id_rsa
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
echo 'host github.com' >> /etc/ssh/ssh_config
echo ' HostName github.com' >> /etc/ssh/ssh_config
echo ' IdentityFile /home/id_rsa' >> /etc/ssh/ssh_config
echo ' User git' >> /etc/ssh/ssh_config
echo ' IdentitiesOnly yes' >> /etc/ssh/ssh_config
git clone git@github.com:getdreams/dreams-ansible.git /home/dreams-ansible
export ANSIBLE_VAULT_PASSWORD='""" + ansible_vault_pwd + """'
cd /home/dreams-ansible
./bin/ansible-wrapper
./bin/run_build.sh
apt-get install rsync -qq -y
./bin/deploy dreams develop --limit=tag_Role_product_admin"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment