Skip to content

Instantly share code, notes, and snippets.

@schisamo
Created April 19, 2011 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save schisamo/34be55a395167206e7aa to your computer and use it in GitHub Desktop.
Save schisamo/34be55a395167206e7aa to your computer and use it in GitHub Desktop.
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download.elff.bravenet.com/5/i386/elff-release-5-3.noarch.rpm
yum install -q -y ruby ruby-devel gcc gcc-c++ automake autoconf make
cd /tmp
arch=$(uname -m)
# grab the fat installer
wget http://opensource.marshall.edu/chef/chef-fat-installer-rhel5.${arch}.run
# run the fat installer
chmod a+x chef-fat-installer-rhel5.${arch}.run
./chef-fat-installer-rhel5.${arch}.run
# rvm up
if [ -x /etc/profile.d/rvm.sh ]; then
. /etc/profile.d/rvm.sh
fi
fi
gem install ohai chef --no-rdoc --no-ri --verbose <%= '--prerelease' if @config[:prerelease] %>
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 (fqdn)
<% else %>
node_name "<%= @config[:chef_node_name] %>"
<% end %>
<% unless @config[:environment].nil? %>
environment "<%= @config[:environment] %>"
<% end %>
EOP
) > /etc/chef/client.rb
(
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