Skip to content

Instantly share code, notes, and snippets.

@crhan
Last active January 1, 2016 14:28
Show Gist options
  • Save crhan/8157604 to your computer and use it in GitHub Desktop.
Save crhan/8157604 to your computer and use it in GitHub Desktop.
chef deploy rbenv and binary ruby
default["ops-oob"]["rbenv_tar"] = "rbenv_6u2.tar.gz"
# rbenv setup
export RBENV_ROOT=/usr/local/rbenv
eval "$(rbenv init -)"
case node['platform_version']
when /5\./
node.default["ops-oob"]["rbenv_tar"] = "rbenv_5u7.tar.gz"
when /6\./
node.default["ops-oob"]["rbenv_tar"] = "rbenv_6u2.tar.gz"
end
package "libyaml"
pacakge "libffi"
group "rbenv" do
members "oob"
system true
append true
end
execute "wget http://172.24.102.200/download/rbenv/#{node["ops-oob"]["rbenv_tar"]} -O - | tar xzf - -C /usr/local/" do
not_if "test -d /usr/local/rbenv/"
end
link "/usr/local/bin/rbenv" do
to "/usr/local/rbenv/bin/rbenv"
end
cookbook_file "rbenv.profile.sh" do
path "/etc/profile.d/rbenv.sh"
mode 00755
end
execute "correct rbenv ownership and mod" do
command 'find /usr/local/rbenv -type d -and \( -not -perm /2000 -or -not -group rbenv \) -exec chmod g+Xs {} \; -exec chown :rbenv {} \;'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment