Created
November 30, 2011 13:04
-
-
Save pinetops/1408988 to your computer and use it in GitHub Desktop.
Centos/RVM chef bootstrap template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on ubuntu version from http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby | |
# Tested on Centos 5.6 | |
bash -c ' | |
if [ ! -f /usr/local/bin/chef-client ]; then | |
# yum install -y git curl gcc gcc-c++ zlib-devel openssl-devel readline-devel flex bison libxml2-devel libxslt-devel zlib-devel | |
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel git | |
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) | |
( | |
cat <<'EOP' | |
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . /usr/local/rvm/scripts/rvm # This loads RVM into a shell session. | |
EOP | |
) > /etc/profile.d/rvm.sh | |
source /etc/profile | |
rvm install 1.9.2 | |
rvm --default 1.9.2 | |
gem install ohai chef --no-rdoc --no-ri --verbose <%= '--prerelease' if @config[:prerelease] %> | |
ln -nfs $(which chef-client) /usr/bin/chef-client | |
fi | |
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" | |
<% else %> | |
node_name "<%= @config[:chef_node_name] %>" | |
<% end %> | |
EOP | |
) > /etc/chef/client.rb | |
( | |
cat <<'EOP' | |
<%= { "run_list" => @run_list }.to_json %> | |
EOP | |
) > /etc/chef/first-boot.json | |
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