Install puppet in rvm

rvm lets us specify specific versions of ruby to use in different directories,it leaves the system wide ruby installed untouched.

Steps

  • Install rvm
  • Install desired ruby version
  • Change to desired ruby version
  • Make it permanent only to a specific dir
  • Install the puppet gem
  • Modify the puppet startup script to pick our ruby
  • Test server/client

Install the rvm using the installer

rvm-installer

echo insecure >> ~/.curlrc
[root@machine-node1 tmp]# ./rvm-installer
Downloading RVM from wayneeseguin branch master
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 125 100 125 0 0 78 0 0:00:01 0:00:01 --:--:-- 0
0 125 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
100 918k 100 918k 0 0 14241 0 0:01:06 0:01:06 --:--:-- 25817
/usr/local/rvm/src/rvm
Installing RVM to /usr/local/rvm/
Creating RVM system user group 'rvm'
Install done

Let us install puppet gem

After manually changing to the ruby version that we like

[root@machine-node1 ~]# ruby -v
ruby 1.8.5 (2006-08-25) [x86_64-linux]
cd puppet_test
rvm use 1.9.2
[root@machine-node1 puppet_test]# which ruby
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby

We should maybe specify which version of the gem to install

gem install -v 2.7.9 puppet
Fetching: puppet-2.7.9.gem (100%)
Successfully installed puppet-2.7.9
1 gem installed
Installing ri documentation for puppet-2.7.9...
Installing RDoc documentation for puppet-2.7.9...

Lets check that
/usr/local/rvm/gems/ruby-1.9.2-p290/gems
[root@machine-node1 gems]# ls
bundler-1.0.22 facter-1.6.5 puppet-2.7.9

Make a ruby version permanent for a specific directory

[root@machine-node1 puppet_test]# rvm --rvmrc --create 1.9.2
[root@machine-node1 puppet_test]# ls -a
. .. .rvmrc
cd .
[root@machine-node1 puppet_test]# ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

This sets the desired ruby version every time we cd into this dir

Puppet client testing

[root@machine-node1 puppe_test]# ls
puppetd show start_puppet.sh sysconfig

This puppetd had to be modified to remove the #! line so that it doesn’t pick up the /usr/bin/ruby
start_puppet.sh uses just ruby like below
#!/bin/bash
ruby ${PWD}/puppetd --no-daemonize --server machine-master.hostname.com --waitforcert 20 -v -d

cd into the dir and ./start_puppet.sh, this picks us the specific ruby version because of the rvmrc file

notice: Starting Puppet client version 2.7.9
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/puppet-2.7.9/lib/puppet/provider/service/freebsd.rb:10: warning: class variable access from toplevel
info: Caching catalog for machine-node2.hostname.com
info: Applying configuration version '1329913689'
notice: /Stage[main]/Hardening::Services/Hardening::Services::Service_stop[bluetooth]/Service[bluetooth]/ensure: ensure changed 'running' to 'stopped'
notice: Finished catalog run in 5.22 seconds
notice: Caught INT; calling stop

You should change the puppetmasterd file like what we did for the puppetd file, removing the shabang and adding just ruby to the invocation
 
Please comment on any other ways to test these

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: