Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.