Skip to content

Instantly share code, notes, and snippets.

@millisami
Created July 6, 2012 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save millisami/3058377 to your computer and use it in GitHub Desktop.
Save millisami/3058377 to your computer and use it in GitHub Desktop.
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
export LANG=en_US.UTF-8
apt-get update
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get upgrade -y
apt-get install -y build-essential wget curl clang bison openssl zlib1g ncurses-dev libxslt1.1 libssl-dev libxslt1-dev libxml2 libffi-dev libyaml-dev libxslt-dev autoconf libc6-dev libreadline6-dev zlib1g-dev libcurl4-openssl-dev libgdbm-dev git-core
#apt-get install -y build-essential ruby1.9.1 ruby1.9.1-dev git-core
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar xzvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
./configure --disable-install-doc
make
make install
cd ..
rm -rf ruby-1.9.3*
cd ~
fi
gem install ohai -v 0.6.12 --no-rdoc --no-ri --verbose
gem install chef -v 0.10.8 --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
if [ -f /usr/bin/chef-client ]; then
rm -f /usr/bin/chef-client
fi
ln -nfs $(which chef-client) /usr/bin/chef-client
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