title: Puppet: install Rubygem-package on a machine without Rubygems preinstalled
body: <p>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. </p>
  
  <p>This is my manifest so far (I kept it simple):</p>
  
  <pre><code># test.pp
  Package { ensure =&gt; 'installed' } 
  
  package { 
    'rubygems' : 
      name =&gt; 'rubygems',
  }
  
  package {
    'libldap-ruby1.8' :
      name =&gt; 'libldap-ruby1.8',
  }
  
  package { 'libldap2-dev' : 
     name =&gt; 'libldap2-dev', 
  }
  
  package { 'libsasl2-dev' : 
    name =&gt; 'libsasl2-dev', 
  }
  
  package { 'libsasl2-modules-ldap' : 
    name =&gt; 'libsasl2-modules-ldap', 
  }
  
  # My Rubygem, with Provider type 'gem'
  package { 
    'ruby-ldap' : 
      name =&gt; 'ruby-ldap',
      provider =&gt; 'gem',
  }
  
  Package [ 'rubygems' ] -&gt; Package [ 'ruby-ldap' ] 
  Package [ 'libldap2-dev' ] -&gt; Package [ 'ruby-ldap' ]
  Package [ 'libsasl2-modules-ldap' ] -&gt; Package [ 'ruby-ldap' ]
  </code></pre>
  
  <p>When I test this manifest (with <code>puppet apply --noop test.pp</code>), I'm getting the following output:</p>
  
  <pre><code>err: /Stage[main]//Package[ruby-ldap]: Provider gem is not functional on this host
  </code></pre>
  
  <p>I digged through the net and found some informations about Puppet+Rubygems (for example <a href="https://groups.google.com/forum/?fromgroups#!topic/puppet-users/7DdudbY90cY" rel="nofollow">this</a>) but none of these helped me to solve my problem as none provided a real solution with some code.</p>
  
  <p>I also tried using classes and stages (doing the rubygem install in a stage before the gem install) but I always got the <code>Provider gem</code>-error (but maybe I just used the stages in a wrong way). </p>
  
  <p>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?</p>