- From: AJ Christensen <
>
- To: chef <
>
- Subject: [chef] Re: Re: Re: rbenv setup for system wide
- Date: Mon, 25 Feb 2013 09:48:03 +1300
You'll want 'recipe[rbenv::system_install]' and any appropriate $PATH
modifications via /etc/profile.d -- can be a file/contents; make use
of the LWRP 'rbenv_global' [0]
As I mentioned previously, a node attribute hash-map like this suits:
node.default['my_org_rbenv']['system_rubygems']['1.9.3-p194'] = {
bundler: {
version: '1.2.3',
action: 'install',
}
}
system_ruby_version = node['my_org_rbenv']['system_ruby_version']
rbenv_global system_ruby_version
node['my_org_rbenv']['system_rubygems'][system_ruby_version].each do
|gem, params|
rbenv_gem gem do
rbenv_version systemruby
version params['version']
action params['action'].to_sym
end
end
Note that this only reduces repetition and is not required at all.
Cheers,
AJ
[0] rbenv LWRPs:
https://github.com/fnichol/chef-rbenv#lwrps
On 25 February 2013 07:10, S Ahmed
<
>
wrote:
>
thanks, looks like I got most of it.
>
>
1. How do I set it as global (system wide, not user specific?):
>
default.rb:
>
>
include_recipe "rbenv::default"
>
include_recipe "rbenv::ruby_build"
>
>
rbenv_ruby "1.9.3-p194"
>
>
After my chef-solo ran, I get this when doing: ruby
>
>
rbenv: ruby: command not found
>
>
The `ruby' command exists in these Ruby versions:
>
1.9.3-p194
>
>
>
2. if I want to install more gems, I have to keep repeating this or like you
>
said put it in a each loop right?
>
>
rbenv_gem "bundler" do
>
ruby_version "1.9.3-p194"
>
end
>
>
rbenv_gem "rubygems" do
>
ruby_version "1.9.3-p194"
>
end
>
>
..
>
..
>
>
>
>
On Mon, Feb 18, 2013 at 4:17 PM, AJ Christensen
>
<
>
>
wrote:
>
>
>
> Oh, as for gems: toss 'em in an attribute, map the attribute into
>
> gem_package resources after rbenv is installed and activated so that
>
> gem_package goes to the correct VM.
>
>
>
> Cheers,
>
>
>
> AJ
>
>
>
> On 19 February 2013 10:14, AJ Christensen
>
> <
>
>
> wrote:
>
> > Create a cookbook "myorg_system_wide_ruby" and add the rbenv 'related
>
> > code' you mentioned in there.
>
> >
>
> > depends goes into metadata.rb, the rest in a recipe
>
> >
>
> > Cheers,
>
> >
>
> > AJ
>
> >
>
> > On 19 February 2013 10:11, S Ahmed
>
> > <
>
>
> > wrote:
>
> >> Thanks to your suggestions, I am going to use rbenv to manage my
>
> >> servers
>
> >> system wide ruby and gems setup.
>
> >>
>
> >> From the readme it seems to alude to using rbenv as dependancy to a
>
> >> cookbook, but I want to setup a system wide (default) ruby and
>
> >> rubygems.
>
> >>
>
> >> Does this mean I have to put this in my role_name.rb file? (I'm using
>
> >> chef-solo).
>
> >>
>
> >> My current base.rb is:
>
> >>
>
> >> name 'base'
>
> >> description 'base role that all nodes will have'
>
> >> run_list "recipe[build-essential]", "recipe[ohai]", "recipe[runit]",
>
> >> "recipe[yum]", "recipe[openssl]", "recipe[git]", "recipe[apt]",
>
> >> "recipe[java]"
>
> >>
>
> >> So do I put rbenv related code in here like:
>
> >>
>
> >> depends 'rbenv'
>
> >>
>
> >> include_recipe "rbenv::default"
>
> >> include_recipe "rbenv::ruby_build"
>
> >>
>
> >> rbenv_ruby "1.9.3-p194"
>
> >>
>
> >> rbenv_gem "bundler" do
>
> >> ruby_version "1.9.3-p194"
>
> >> end
>
> >>
>
> >>
>
> >> How can I create a list of gems I want pre-installed for default ruby
>
> >> to be
>
> >> able to access?
>
>
Archive powered by MHonArc 2.6.16.