huboard/puppet-rbenv

Name: puppet-rbenv

Owner: HuBoard

Description: Puppet manifest for rbenv installation

Created: 2015-10-30 15:47:28.0

Updated: 2016-07-04 22:11:08.0

Pushed: 2015-10-30 16:54:54.0

Homepage:

Size: 309

Language: Puppet

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Puppet-Rbenv

Build Status endorse

About

This project provides powerful manifests for the installation of rbenv (Ruby Version Management). In a nutshell, it supports the following conveniences:

Rbenv installation

You can use the module in your manifest with the following code:

v::install { "someuser":
oup => 'project',
me  => '/project'

This will apply an rbenv installation under “someuser” home dir and place it into “.rbenv”. You can change the resource title to your taste, and pass the user on which install rbenv using the user parameter.

The rbenv directory can be changed by passing the “root” parameter, that must be an absolute path.

Ruby compilation

To compile a ruby interpreter, you use rbenv::compile as follows:

v::compile { "1.9.3-p327":
er => "someuser",
me => "/project",

The resource title is used as the ruby version, but if you have multiple rubies under multiple users, you'll have to define them explicitly:

v::compile { "foo/1.8.7":
er => "foo",
by => "1.8.7-p370",


v::compile { "bar/1.8.7":
er => bar",
by => "1.8.7-p370",

rbenv rehash is performed each time a new ruby or a new gem is installed.

You can use the global => true parameter to set an interpreter as the default (rbenv global) one for the given user. Please note that only one global is allowed, duplicate resources will be defined if you specify multiple global ruby version.

You can also provide a custom build definition to ruby-build by specifying a source that can either be a puppet: source or a file to be downloaded using wget:

v::compile { "patched-ree":
er   => "someuser",
me   => "/project",
urce => "puppet://path-to-definition"

If you're using debugger gems, you'll probably need to keep source tree after building. This is achieved by passing keep => true parameter.

v::compile { "bar/1.8.7":
er => bar",
by => "1.8.7-p370",
ep => true,

Gem installation

You can install and keep gems updated for a specific ruby interpreter:

v::gem { "unicorn":
er => "foobarbaz",
by => "1.9.3-p327",

Gems are handled using a custom Package provider that handles gems, somewhat inspired by Puppet's Package one - thus absent and latest work as expected.

You can specify a gem source with the optional source parameter:

v::gem { "my_private_gem":
er   => "foobarbaz",
by   => "1.9.3-p327",
urce => "http://gems.mydoma.in/"

rbenv plugins

To add a plugin to a rbenv installation, you use rbenv::plugin as follows:

v::plugin { "my-plugin":
er   => "someuser",
urce => "git://github.com/user/my-plugin.git"

There's also a built-in resource to add rbenv-vars for a user:

v::plugin::rbenvvars { "someuser":
Optional:
source => "git://path-to-your/custom/rbenv-vars.git"

NOTICE: rbenv::install automatically requires ruby-build to compile rubies, if you want to use a different repository, you can specify the resource on a separate manifest:

v::plugin::rubybuild { "someuser":
urce => "git://path-to-your/git/repo"

Install module from puppet forge

You can install the latest release of this module by using the following command:

et module install alup-rbenv
Usage with Vagrant

A simple way to test this module is by using the Vagrant library.

An example of a Vagrantfile:

ant::Config.run do |config|
onfig.vm.box = "lucid32"
onfig.vm.provision :puppet, :facter => { "osfamily" => "debian" }, :module_path => "modules" do |puppet|
 puppet.manifests_path = "manifests"
 puppet.manifest_file  = "base.pp"
 puppet.options        = %w[ --libdir=\\$modulepath/rbenv/lib ]
nd

The --libdir=\\$modulepath/rbenv/lib argument is important to make puppet aware of the rbenvgem custom provider and type.

Notes

This project contains a custom rbenvgem type for use by the client via module.

Custom types and facts (plugins) are gathered together and distributed via a file mount on your Puppet master.

To enable module distribution you need to make changes on both the Puppet master and the clients. Specifically, pluginsync must be enabled in puppet.conf configuration file on both the master and the clients.

n]
insync = true
Supported Platforms
License

MIT License.

Copyright 2012-2015 Andreas Loupasakis, Marcello Barnaba vjt@openssl.it, Fabio Rehm


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.