Ruby dependencies and versions on distro's aren't always maintained to our liking. I've had problems deploying Chef on CentOS appliances running ruby on rails apps that break when the packages for Chef are installed. I know the problem should be fixed so dependencies can be handled correctly, but that's not always going to happen as quickly as we'd like.
So I adapted the default CentOS bootstrap script to install Chef within an rbenv environment.
Hopefully I won't need to ever do this for Debian.
Since this is limited to CentOS I have the following hard-coded condition in the recipe[chef-client::service]
*** service.rb.orig 2012-03-29 22:36:48.000000000 +0100
--- service.rb 2012-03-18 14:29:20.000000000 +0000
***************
*** 50,55 ****
--- 50,60 ----
init_content = IO.read("#{node["languages"]["ruby"]["gems_dir"]}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/init.d/chef-client")
conf_content = IO.read("#{node["languages"]["ruby"]["gems_dir"]}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/#{conf_dir}/chef-client")
+ # We're always using rbenv on CuntOS, so ensure the service does too
+ if platform?("centos") then
+ conf_content = "#{conf_content}\nexport PATH=\"$HOME/.rbenv/bin:/usr/local/bin:$PATH\"\neval \"$($HOME/.rbenv/bin/rbenv init -)\"\nrbenv shell $(rbenv versions | tail -n 1| grep -Eo '\w+\.\w+\.\w+-\w+')\n"
+ end
+
file "/etc/init.d/chef-client" do
content init_content
mode 0755
Adapt the following bootstrap script as needed, and use at your own risk.
"Opscode Chef client within an rbenv environment"
No comments yet. -