install-chef+rvm

by north5
4 deployments · 2 still active · last rev. 2 years ago

installs rvm and chef 11.4.4

Compatible with: No distros currently supported
						#!/bin/bash
# Install RVM and chef
# Stack ID 6145

# <udf name="chef_version" label="chef version" default="11.12.4">
# <udf name="ruby_to_install" label="ruby version" default="ruby-2.1.1">
# <udf name="rvm_version" label="rvm version" default="stable">

logfile=${logfile:-/root/stackscript.log}

# Get curl and build-essential
apt-get -y install curl build-essential

# Download and install rvm package
# --------------------------------
echo "Download and setting up RVM" >> $logfile

curl -L https://get.rvm.io | bash -s ${RVM_VERSION}
. /etc/profile.d/rvm.sh

# Install ruby
echo  "Installing ruby version [${RUBY_TO_INSTALL}]" >> $logfile
rvm install ${RUBY_TO_INSTALL} --autolibs=3
rvm use ${RUBY_TO_INSTALL} --default

# Remove buggy bundler in 2.1.1 bulndler is okay
# gem install bundler -v '~> 1.5.1' --no-ri --no-rdoc
# gem uninstall -i /usr/local/rvm/gems/${RUBY_TO_INSTALL}@global bundler

# Install chef using bundler
echo "Installing chef version ${CHEF_VERSION}" >> $logfile

cat >/tmp/chef_gemfile<<EOF
source "http://rubygems.org"
gem "chef", "${CHEF_VERSION}"
EOF

# Previously we've chosen the default rvm environment
bundle install --gemfile /tmp/chef_gemfile
rm /tmp/chef_gemfile