Skip to content

Instantly share code, notes, and snippets.

@wallace
Created January 29, 2011 11:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallace/801764 to your computer and use it in GitHub Desktop.
Save wallace/801764 to your computer and use it in GitHub Desktop.
chef 0.9.12's install chef from gems bootstrap file
<%
# This file ensures that chef is using the currently installed version of ruby instead of installing it's own.
# This is necessary because the AMI we use already has the desired version of ruby installed on it.
%>
bash -c '
gem install ohai -v0.5.8 --no-rdoc --no-ri --verbose <%= '--prerelease' if @config[:prerelease] %>
gem install chef -v0.9.12 --no-rdoc --no-ri --verbose <%= '--prerelease' if @config[:prerelease] %>
mkdir -p /etc/chef
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
log_level :info
log_location STDOUT
chef_server_url "<%= Chef::Config[:chef_server_url] %>"
validation_client_name "<%= Chef::Config[:validation_client_name] %>"
<% if @config[:chef_node_name] == nil %>
# Using default node name"
<% else %>
node_name "<%= @config[:chef_node_name] %>"
<% end %>
EOP
) > /etc/chef/client.rb
(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json
/usr/bin/chef-client -j /etc/chef/first-boot.json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment