Puppet: install Rubygem-package on a machine without Rubygems preinstalled
-
07-06-2021 - |
Question
On a clean Debian system - without Rubygems installed - I want to install a Rubygem package with Puppet (Version 2.7.13). 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?
Solution
Although my problem should be fixed with Puppet 2.7.8 (I was using 2.7.13) - see this issue - I'm quite sure that I had this problem with 2.7.13.
I re-tried this on another machine with 2.7.14 installed, there I can succesfully install Rubygems and a Rubygem-package with Puppet.