Skip to content

Instantly share code, notes, and snippets.

@ScriptAutomate
Last active July 28, 2018 19:47
Show Gist options
  • Save ScriptAutomate/b680bbda41f3cbe590b648df949f3fcf to your computer and use it in GitHub Desktop.
Save ScriptAutomate/b680bbda41f3cbe590b648df949f3fcf to your computer and use it in GitHub Desktop.
Secure360: Preparing Ubuntu 16.04 dev desktop for presentation
exit #prevent accidental run of script
# App versions
PACKERVER='0.10.1'
VAGRANTVER='1.8.5'
CHEFDKVER='0.17.17'
CHEFDKRUBYVER='2.1.0'
CHEFDKRUBYPATH="export PATH=\"$PATH:/home/dscripter/.chefdk/gem/ruby/$CHEFDKRUBYVER/bin\""
# Install Git and Unzip
sudo apt-get install git unzip -y
# Download and Install Vagrant, Packer, and ChefDK
wget https://releases.hashicorp.com/packer/$PACKERVER/packer_${PACKERVER}_linux_amd64.zip > ~/Downloads/packer_${PACKERVER}_linux_amd64.zip
wget https://releases.hashicorp.com/vagrant/$VAGRANTVER/vagrant_${VAGRANTVER}_x86_64.deb > ~/Downloads/vagrant_${VAGRANTVER}_x86_64.deb
wget https://packages.chef.io/stable/ubuntu/12.04/chefdk_$CHEFDKVER-1_amd64.deb > ~/Downloads/chefdk_$CHEFDKVER-1_amd64.deb
sudo dpkg -i ~/Downloads/chefdk_$CHEFDKVER-1_amd64.deb
sudo dpkg -i ~/Downloads/vagrant_${VAGRANTVER}_x86_64.deb
sudo unzip packer_${PACKERVER}_linux_amd64.zip -d /usr/bin
# Get custom Git Bash prompt and set it up
git clone https://github.com/magicmonty/bash-git-prompt.git ~
echo "# ChefDK Ruby Path
PATH=\"$PATH:$CHEFDKRUBYPATH\"
# Custom git bash prompt
# Prereq: https://github.com/magicmonty/bash-git-prompt
source ~/.bash-git-prompt/gitprompt.sh
GIT_PROMPT_ONLY_IN_REPO=1" >> ~/.bashrc
# Get vagrant and kitchen plugins
vagrant plugin install vagrant-aws
kitchen gem install kitchen-dsc kitchen-ec2 kitchen-pester
# Special thanks to Matt Wrock: http://www.hurryupandwait.io/
# Get base Windows vagrant boxes
vagrant box add mwrock/Windows2012R2 --provider virtualbox
vagrant box add mwrock/WindowsNanoDSC --provider virtualbox
vagrant box add mwrock/Windows2016 --provider virtualbox
# Setup initial 2012R2 vagrant box with WMF 5.0
mkdir -p ~/testkitchen/vagrants/win2012r2
cd ~/testkitchen/vagrants/win2012r2
vagrant init mwrock/Windows2012R2 --provider virtualbox
# Download WMF5 for 2012R2 then copy it to current dir
# Win8.1AndW2K12R2-KB3134758-x64.msu
# https://www.microsoft.com/en-us/download/confirmation.aspx?id=50395
cp ~/Downloads/Win8.1AndW2K12R2-KB3134758-x64.msu .
vagrant up
# Install WMF5 as the .msu should be available via a c:\vagrant share
# After instance has restarted with WMF5 installed, do the following
vagrant package --output win2012r2-wmf5.box
vagrant box add win2012r2-wmf5 win2012r2-wmf5.box
vagrant destroy
# Setup our kitchen
cd ~/testkitchen
git clone [email protected]:ScriptAutomate/secure360-dsc-jea.git
cd ..
# Run the thangs
VBoxManage hostonlyif create
VBoxManage list hostonlyifs
kitchen create
kitchen converge
# When done with lab, run the following
kitchen destroy
# From now on, lab can be spun up easily by being present in dir
# and running kitchen create; kitchen converge; kitchen destroy
# or kitchen test (spings up, converges, tests, destroys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment