Skip to content

Instantly share code, notes, and snippets.

@nicolas-g
Created July 21, 2015 22:56
Show Gist options
  • Save nicolas-g/d648db66ee9db2a15af7 to your computer and use it in GitHub Desktop.
Save nicolas-g/d648db66ee9db2a15af7 to your computer and use it in GitHub Desktop.
#!/bin/bash -v
# Install prereguisites
yum update ca-certificates -y
yum install epel-release -y
yum install ansible -y
yum install git -y
yum install s3cmd -y
# setup private key that will be used to clone git repo
s3cmd get --force s3://mybucket/.ssh/id_rsa /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
# set Github ssh known_hosts
(
cat << 'EOP'
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
EOP
) > /root/.ssh/known_hosts
# clone my Ansible repo
git clone [email protected]:MyProject/Ansible.git /root/ansible
# deploy /root/ansible/.vault_pass
(
cat << 'EOP'
mypassword
EOP
) > /root/ansible/.vault_pass
# run ansible-playbook to configure this server
ansible-pull -U [email protected]:MyProject/Ansible.git -d /root/ansible -o --checkout=develop web.yml -i /root/ansible/etc/ansible/hosts --vault-password-file .vault_pass -f >>/var/log/ansible-pull.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment