Monday, May 14, 2012

Puppet: install Rubygem-package on a machine without Rubygems preinstalled

On a clean Debian system - without Rubygems installed - I want to install a Rubygem package with Puppet. So the package has "gem" as package Provider.



This is my manifest so far (I kept it simple):



# test.pp
Package { ensure => 'installed' }

package {
'rubygems' :
name => 'rubygems',
}

package {
'libldap-ruby1.8' :
name => 'libldap-ruby1.8',
}

package { 'libldap2-dev' :
name => 'libldap2-dev',
}

package { 'libsasl2-dev' :
name => 'libsasl2-dev',
}

package { 'libsasl2-modules-ldap' :
name => 'libsasl2-modules-ldap',
}

# My Rubygem, with Provider type 'gem'
package {
'ruby-ldap' :
name => 'ruby-ldap',
provider => 'gem',
}

Package [ 'rubygems' ] -> Package [ 'ruby-ldap' ]
Package [ 'libldap2-dev' ] -> Package [ 'ruby-ldap' ]
Package [ 'libsasl2-modules-ldap' ] -> Package [ 'ruby-ldap' ]


When I test this manifest (with puppet apply --noop test.pp), I'm getting the following output:



err: /Stage[main]//Package[ruby-ldap]: Provider gem is not functional on this host


I digged through the net and found some informations about Puppet+Rubygems (for example this) but none of these helped me to solve my problem as none provided a real solution with some code.



I also tried using classes and stages (doing the rubygem install in a stage before the gem install) but I always got the Provider gem-error (but maybe I just used the stages in a wrong way).



Can anyone provide me a working manifest which installs rubygems and any rubygem on a system without Rubygems, or at least the final hints how to get there?





No comments:

Post a Comment