Skip to content

Instantly share code, notes, and snippets.

@bensie
Created June 11, 2011 23:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bensie/1021097 to your computer and use it in GitHub Desktop.
Save bensie/1021097 to your computer and use it in GitHub Desktop.
Chef Bootstrap With RVM and 1.9.2 (Ubuntu)
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libc6-dev
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
(
cat <<'EOP'
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.
EOP
) > /etc/profile.d/rvm.sh
source /etc/profile
rvm install 1.9.2-p180
rvm use 1.9.2-p180 --default
fi
gem install ohai --no-rdoc --no-ri --verbose
gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
ln -nfs $(which chef-client) /usr/bin/chef-client
mkdir -p /etc/chef
(
cat <<'EOP'
<%= validation_key %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
<%= config_content %>
EOP
) > /etc/chef/client.rb
(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json
<%= start_chef %>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment