Created
May 1, 2010 04:43
-
-
Save hedgehog/386057 to your computer and use it in GitHub Desktop.
EC2 AMI with chef-server installed
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
# install_chef_server.sh | |
# | |
# From list post by John Merrells <[email protected]> | |
# Modified by Mike Bailey <[email protected]> | |
logfile="/root/log.txt" | |
echo "-----" >> $logfile | |
# New sources.list | |
cat > /etc/apt/sources.list << EOF | |
deb http://archive.ubuntu.com/ubuntu/ karmic main restricted | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic main restricted | |
deb http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted | |
deb http://archive.ubuntu.com/ubuntu/ karmic universe | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic universe | |
deb http://archive.ubuntu.com/ubuntu/ karmic-updates universe | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates universe | |
deb http://archive.ubuntu.com/ubuntu/ karmic multiverse | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic multiverse | |
deb http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse | |
deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse | |
deb http://security.ubuntu.com/ubuntu karmic-security main restricted | |
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted | |
deb http://security.ubuntu.com/ubuntu karmic-security universe | |
deb-src http://security.ubuntu.com/ubuntu karmic-security universe | |
deb http://security.ubuntu.com/ubuntu karmic-security multiverse | |
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse | |
EOF | |
# Update System | |
apt-get -y update | |
# Installing ruby | |
apt-get -y install build-essential >> $logfile | |
apt-get -y install ruby >> $logfile | |
apt-get -y install ruby-dev >> $logfile | |
apt-get -y install libzlib-ruby >> $logfile | |
apt-get -y install libyaml-ruby >> $logfile | |
apt-get -y install libopenssl-ruby >> $logfile | |
apt-get -y install runit >> $logfile | |
# Installing rubygems | |
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz | |
tar xzvf rubygems-1.3.6.tgz >> $logfile | |
cd rubygems-1.3.6 | |
ruby setup.rb >> $logfile | |
ln -s /usr/bin/gem1.8 /usr/bin/gem | |
gem update --no-ri --no-rdoc --system >> $logfile | |
# http://wiki.opscode.com/display/chef/Preparing+Debian+and+Ubuntu+for+RubyGems | |
apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert | |
gem install --no-ri --no-rdoc chef | |
# http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation | |
cat > ~/solo.rb <<EOF | |
file_cache_path "/tmp/chef-solo" | |
cookbook_path "/tmp/chef-solo/cookbooks" | |
recipe_url "http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz" | |
EOF | |
cat > ~/chef.json <<EOF | |
{ | |
"bootstrap": { | |
"chef": { | |
"url_type": "http", | |
"init_style": "runit", | |
"path": "/srv/chef", | |
"serve_path": "/srv/chef", | |
"server_fqdn": "chef.failmode.com", | |
"webui_enabled": true | |
} | |
}, | |
"run_list": [ "recipe[bootstrap::server]" ] | |
} | |
EOF | |
chef-solo -c ~/solo.rb -j ~/chef.json | |
sudo /etc/init.d/chef-server restart | |
sudo /etc/init.d/chef-server-webui restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment