Skip to content

Instantly share code, notes, and snippets.

@stphung
Created October 31, 2011 21:50
Show Gist options
  • Save stphung/1329105 to your computer and use it in GitHub Desktop.
Save stphung/1329105 to your computer and use it in GitHub Desktop.
A knife bootstrap template which uses the beta-install.sh at http://opscode.com/beta-install.sh
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
if [ ! -f /usr/bin/chef-client ]; then
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://opscode.com/beta-install.sh
sh beta-install.sh
fi
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
<% if @chef_config[:encrypted_data_bag_secret] -%>
(
cat <<'EOP'
<%= encrypted_data_bag_secret %>
EOP
) > /tmp/encrypted_data_bag_secret
awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
rm /tmp/encrypted_data_bag_secret
<% end -%>
(
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