-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Prakash Admane
committed
Jul 4, 2018
0 parents
commit cba25bf
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vagrant | ||
*.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# DevOps box | ||
* A vagrant project with an ubuntu box with the tools needed to do DevOps | ||
|
||
# tools included | ||
* Terraform | ||
* AWS CLI | ||
* Ansible |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Vagrant.configure(2) do |config| | ||
config.vm.define "devops-box" do |devbox| | ||
devbox.vm.box = "ubuntu/xenial64" | ||
devbox.vm.network "private_network", ip: "192.168.199.9" | ||
devbox.vm.hostname = "devops-box" | ||
devbox.vm.provision "shell", path: "scripts/install.sh" | ||
devbox.vm.provider "virtualbox" do |v| | ||
v.memory = 4096 | ||
v.cpus = 2 | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
if [ -e /etc/redhat-release ] ; then | ||
REDHAT_BASED=true | ||
fi | ||
|
||
TERRAFORM_VERSION="0.11.7" | ||
PACKER_VERSION="1.2.4" | ||
# create new ssh key | ||
[[ ! -f /home/ubuntu/.ssh/mykey ]] \ | ||
&& mkdir -p /home/ubuntu/.ssh \ | ||
&& ssh-keygen -f /home/ubuntu/.ssh/mykey -N '' \ | ||
&& chown -R ubuntu:ubuntu /home/ubuntu/.ssh | ||
|
||
# install packages | ||
if [ ${REDHAT_BASED} ] ; then | ||
yum -y update | ||
yum install -y docker ansible unzip wget | ||
else | ||
apt-get update | ||
apt-get -y install docker.io ansible unzip | ||
fi | ||
# add docker privileges | ||
usermod -G docker ubuntu | ||
# install pip | ||
pip install -U pip && pip3 install -U pip | ||
if [[ $? == 127 ]]; then | ||
wget -q https://bootstrap.pypa.io/get-pip.py | ||
python get-pip.py | ||
python3 get-pip.py | ||
fi | ||
# install awscli and ebcli | ||
pip install -U awscli | ||
pip install -U awsebcli | ||
|
||
#terraform | ||
T_VERSION=$(/usr/local/bin/terraform -v | head -1 | cut -d ' ' -f 2 | tail -c +2) | ||
T_RETVAL=${PIPESTATUS[0]} | ||
|
||
[[ $T_VERSION != $TERRAFORM_VERSION ]] || [[ $T_RETVAL != 0 ]] \ | ||
&& wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \ | ||
&& unzip -o terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin \ | ||
&& rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip | ||
|
||
# packer | ||
P_VERSION=$(/usr/local/bin/packer -v) | ||
P_RETVAL=$? | ||
|
||
[[ $P_VERSION != $PACKER_VERSION ]] || [[ $P_RETVAL != 1 ]] \ | ||
&& wget -q https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip \ | ||
&& unzip -o packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/bin \ | ||
&& rm packer_${PACKER_VERSION}_linux_amd64.zip | ||
|
||
# clean up | ||
if [ ! ${REDHAT_BASED} ] ; then | ||
apt-get clean | ||
fi |