Skip to content

Instantly share code, notes, and snippets.

@kssminus
Created September 18, 2014 09:18
Show Gist options
  • Save kssminus/81f96e34edf8adbfb5b3 to your computer and use it in GitHub Desktop.
Save kssminus/81f96e34edf8adbfb5b3 to your computer and use it in GitHub Desktop.
centos 5.4 chef bootstrap distro
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
export PATH=$PATH:/usr/local/bin
if [ ! -f /usr/local/bin/chef-client ]; then
#wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
#rpm -Uvh epel-release-5-4.noarch.rpm
#wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://rpm.aegisco.com/aegisco/rhel/aegisco-rhel.rpm
#rpm -Uvh aegisco-rhel.rpm
#
# yum
#
test `rpm -qa gcc`
if [ $? -ne 0 ]; then
yum install -y gcc gcc-c++ automake autoconf make zlib-devel openssl-devel readline-devel curl-devel expat-devel gettext-devel
fi
#
# ruby 1.9.2
#
test `which ruby`
if [ $? -ne 0 ]; then
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
tar zxfv ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290
./configure --enable-shared --disable-install-doc
make && make install
#
# openssl module
#
cd ext/openssl
ruby extconf.rb
make && make install
#
# zlib module
#
cd ../zlib
ruby extconf.rb
make && make install
#
# readline module
#
cd ../readline
ruby extconf.rb
make && make install
fi
#
# gem update
#
gem update --system --no-rdoc --no-ri
gem update --no-rdoc --no-ri
cd /tmp
#
# chef install
#
gem install ohai --no-rdoc --no-ri --verbose
gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
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'
<%= first_boot.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