-
-
Save shayfrendt/267429 to your computer and use it in GitHub Desktop.
Ubuntu Chef Bootstrapper
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/sh | |
trap "exit 2" 1 2 3 13 15 | |
## | |
# Ubuntu. | |
if [ -f "/etc/lsb-release" ]; then | |
### Supported releases. | |
#ISSUE="`awk '{print $2}' /etc/issue`" | |
ISSUE="`awk -F"[ |.]" '{print $2$3}' /etc/issue`" | |
case "${ISSUE}" in | |
804) RELEASE="hardy" ;; | |
810) RELEASE="intrepid" ;; | |
904) RELEASE="jaunty" ;; | |
910) RELEASE="karmic" ;; | |
*) echo "[ERROR] Release '${ISSUE}' not supported!" && exit ;; | |
esac | |
### Enable universe sources. | |
sed -i -e 's/#deb/deb/g' /etc/apt/sources.list | |
### Add opscode sources to apt-get. | |
echo "deb http://apt.opscode.com/ ${RELEASE} universe" > /etc/apt/sources.list.d/opscode.list | |
curl http://apt.opscode.com/[email protected] | apt-key add - || exit 1 | |
apt-get update -y | |
### Upgrade all packages. | |
apt-get upgrade -y --force-yes | |
### No Docs. | |
echo "gem: --no-user-install --no-rdoc --no-ri" > ${HOME}/.gemrc | |
### Install Chef. | |
apt-get install -y ohai chef | |
### Install Git. | |
apt-get install -y git-core | |
### Install Ruby. | |
apt-get install -y ruby ruby1.8-dev rubygems libopenssl-ruby1.8 libsqlite3-ruby irb build-essential | |
### Run chef solo. | |
cd /tmp && git clone git://github.com/retr0h/chef_solo_os.git && cd /tmp/chef_solo_os || exit 1 | |
chef-solo -l debug -c config/solo.rb -j config/dna.json | |
else | |
echo "[ERROR] OS unsupported." | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment