Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created May 6, 2011 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jtimberman/959745 to your computer and use it in GitHub Desktop.
Save jtimberman/959745 to your computer and use it in GitHub Desktop.
Bootstrap template for chef 0.10 with apt.opscode.com, save as ~/.chef/bootstrap/chef-010-apt.erb
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
echo "chef chef/chef_server_url string <%= Chef::Config[:chef_server_url] %>" | debconf-set-selections
[ -f /etc/apt/sources.list.d/opscode.list ] || echo "deb http://apt.opscode.com `lsb_release -cs`-0.10 main" > /etc/apt/sources.list.d/opscode.list
wget -O- http://apt.opscode.com/packages@opscode.com.gpg.key | apt-key add -
fi
apt-get update
apt-get install -y chef
<% unless Chef::Config[:validation_client_name] == "chef-validator" -%>
[ `grep -qx "validation_client_name \"<%= Chef::Config[:validation_client_name] %>\"" /etc/chef/client.rb` ] || echo "validation_client_name \"<%= Chef::Config[:validation_client_name] %>\"" >> /etc/chef/client.rb
<% end -%>
(
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
<% if @config[:chef_node_name] %>
[ `grep -qx "node_name \"<%= @config[:chef_node_name] %>\"" /etc/chef/client.rb` ] || echo "node_name \"<%= @config[:chef_node_name] %>\"" >> /etc/chef/client.rb
<% end -%>
(
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