Skip to content

Instantly share code, notes, and snippets.

@jellybob
Created July 15, 2011 13:37
Show Gist options
  • Save jellybob/1084700 to your computer and use it in GitHub Desktop.
Save jellybob/1084700 to your computer and use it in GitHub Desktop.
sh -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras
fi
# Install a sane version of gems
cd /tmp
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
tar zxf rubygems-1.6.2.tgz
cd rubygems-1.6.2
ruby setup.rb --no-format-executable
gem update --no-rdoc --no-ri
gem install ohai --no-rdoc --no-ri
gem install chef --no-rdoc --no-ri
mkdir -p /tmp/chef-solo/
(
cat <<EOP
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
EOP
) > /tmp/chef-solo/solo.rb
(
cat <<EOP
{
"chef_server": {
"server_url": "http://localhost:4000",
"webui_enabled": true,
"init_style": "init"
},
"run_list": [ "recipe[chef-server::rubygems-install]" ]
}
EOP
) > /tmp/chef-solo/run_list.json
chef-solo -c /tmp/chef-solo/solo.rb -j /tmp/chef-solo/run_list.json -r http://s3-eu-west-1.amazonaws.com/hubbub-server-bootstrap/bootstrap.tgz
mkdir -p ~/.chef
cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R $USER ~/.chef
sudo chmod 0664 ~/.chef/*.pem
# Create an admin account.
knife client create admin -a -k ~/.chef/webui.pem -u chef-webui -n > ~/.chef/admin.pem
rm ~/.chef/webui.pem
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment