Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created December 6, 2011 20:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/1439774 to your computer and use it in GitHub Desktop.
Save jtimberman/1439774 to your computer and use it in GitHub Desktop.
Omnibus Bootstrap Template, latest version I use.
# Refer to CHEF-2815. http://tickets.opscode.com/browse/CHEF-2815
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi
}
install_sh="http://opscode.com/chef/install.sh"
if ! exists /usr/bin/chef-client; then
if exists wget; then
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> ${install_sh} -O - | bash
else
if exists curl; then
curl <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> ${install_sh} | bash
fi
fi
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