Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change gem source to chef cookbook dependency

My recipe

include_recipe 'mysql::server'

and mysql::server call

chef_gem 'mysql'

chef_gem 'mysql' use like gem source http://rubygems.org/

I need use my own gems local server.

How can I change the gem source for all chef running?

OPTION: I try install at first mysql gem with

chef_gem 'mysql' do
  options "--source http://my.own.local.server/"
  version "2.9.1"
end

but don't work.

Any body have other idea?

like image 213
Montells Avatar asked Jan 21 '26 05:01

Montells


1 Answers

There're severals things out of your question:

  • You should use resource gem_package to install gem for system-wide because chef_gem is used for installing gem for dedicated chef usage. see this quote from http://docs.opscode.com/resource_gem_package.html:

Use the chef_gem resource to install gems into the instance of Ruby that is dedicated to the chef-client. Use the gem_package resource to install all other gems (i.e. install gems system-wide).

  • install gem (and its dependencies) from other source than http://rubygems.org/

For example:

gem_package "mysql" do
  options("--clear-sources --source http://my.own.local.server/")
  action :install
  version "2.9.1"
end
like image 74
shawnzhu Avatar answered Jan 24 '26 05:01

shawnzhu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!