A collection of task oriented solutions in Puppet

 

Install a Ruby Gem

Challenge

You want to install a Ruby Gem

Solution

class sinatra {

  package { 'sinatra':
    ensure   => 'installed',
    provider => 'gem',
  }

}

# notice: /Stage[main]//Package[sinatra]/ensure: created

Explanation

Installing a Ruby Gem is very similar to how you install a normal package using your systems package manager. However in this case you need to explicitly state that the gem provider will handle the install.

Much like a package that is installed via the default system provider Puppet will not track new versions of the package unless ensure => 'latest' is set.

See also