Skip to content

Instantly share code, notes, and snippets.

@smith
Created October 29, 2010 22:05
Show Gist options
  • Save smith/654526 to your computer and use it in GitHub Desktop.
Save smith/654526 to your computer and use it in GitHub Desktop.
bash -c '
if [ ! -f /usr/local/bin/chef-client ]; then
apt-get update
apt-get install -y patch wget build-essential libreadline5-dev zlib1g-dev libssl-dev
cd /usr/src
test -f ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz || wget --quiet --timestamping <%= Chef::Config[:ree_url_prefix] %>/ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz
test -d ruby-enterprise-<%= Chef::Config[:ree_version] %> || tar xfz ruby-enterprise-<%= Chef::Config[:ree_version] %>.tar.gz
cd ruby-enterprise-<%= Chef::Config[:ree_version] %>
test -f /usr/local/bin/ruby || ./installer --auto /usr/local
gem install ohai chef --no-rdoc --no-ri --no-update-sources <%= '--prerelease' if @config[:prerelease] %>
ln -nfs $(which chef-client) /usr/local/bin/chef-client
fi
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
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