Forge Home

rbenv

Setup rbenv ruby manager for systemwide use

459,019 downloads

175 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 3.1.0 (latest)
  • 3.0.0
  • 2.5.0
  • 2.4.0
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.5.1
  • 1.5.0
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.1
  • 1.2.0
  • 1.1.0
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 0.2.3
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.0
  • 0.0.4
  • 0.0.2
  • 0.0.1
released Sep 21st 2024
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
  • Puppet >=6.0.0 <9.0.0
  • , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jdowning-rbenv', '3.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jdowning-rbenv
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jdowning-rbenv --version 3.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jdowning/rbenv — version 3.1.0 Sep 21st 2024

puppet-rbenv

Build Status Puppet Forge

Description

This Puppet module will install and manage rbenv. By default, it installs rbenv for systemwide use, rather than for a user or project. Additionally, you can install different versions of Ruby, rbenv plugins, and Ruby gems.

Installation

puppet module install --modulepath /path/to/puppet/modules jdowning-rbenv

Usage

To use this module, you must declare it in your manifest like so:

class { 'rbenv': }

If you wish to install rbenv somewhere other than the default (/usr/local/rbenv), you can do so by declaring the install_dir:

class { 'rbenv': install_dir => '/opt/rbenv' }

You can also ensure rbenv is kept up-to-date:

class { 'rbenv':
  install_dir => '/opt/rbenv'
  latest      => true
}

The class will merely setup rbenv on your host. If you wish to install rubies, plugins, or gems, you will have to add those declarations to your manifests as well.

Installing Ruby using ruby-build

Ruby requires additional packages to operate properly. Fortunately, this module will ensure these dependencies are met before installing Ruby. To install Ruby you will need the ruby-build plugin. Once installed, you can install most any Ruby. Additionally, you can set the Ruby to be the global interpreter.

rbenv::plugin { 'rbenv/ruby-build': }
rbenv::build { '2.0.0-p247': global => true }

Sometimes Ruby needs to be patched prior to being compiled. puppet-rbenv currently supports patching from a single file located either on the Puppet Master or the local filesystem. Therefore, the only accepted paths are those starting with puppet:/// or file:///.

rbenv::build { '2.0.0-p247': patch => 'puppet:///modules/rbenv/patch.patch' }
rbenv::build { '2.0.0-p247': patch => 'file:///path/to/patch.patch' }

Plugins

Plugins can be installed from GitHub using the following definiton:

rbenv::plugin { 'github_user/github_repo': }

You can ensure a plugin is kept up-to-date. This is helpful for a plugin like ruby-build so that definitions are always available:

rbenv::plugin { 'rbenv/ruby-build': latest => true }

Gems

Gems can be installed too! You must specify the ruby_version you want to install for.

rbenv::gem { 'thor': ruby_version => '2.0.0-p247' }

Full Example

site.pp

class { 'rbenv': }
rbenv::plugin { [ 'rbenv/rbenv-vars', 'rbenv/ruby-build' ]: }
rbenv::build { '2.0.0-p247':
  rubygems_version => '3.2.1',
  bundler_version => '1.17.3',
  global => true,
}
rbenv::gem { 'thor': ruby_version => '2.0.0-p247' }

Testing

You can run specs in this module with rspec:

bundle install
bundle exec rake spec

Or with Docker:

docker build -t puppet-rbenv .

Vagrant

You can also test this module in a Vagrant box. There are two box definitons included in the Vagrant file for CentOS and Ubuntu testing. You will need to use librarian-puppet to setup dependencies:

bundle install
bundle exec librarian-puppet install

To test both boxes:

vagrant up

To test one distribution:

vagrant up [centos|ubuntu]