Last active
May 6, 2016 18:05
-
-
Save glarizza/6ca438dc57287c3ec9d2f91bf1edfed3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define domain::gem::localinstall ( | |
$gem_path, | |
$gem_name = $title, | |
$gem_version = undef, | |
$puppetserver_gem_dir = '/opt/puppetlabs/server/data/puppetserver/jruby-gems/gems' | |
) { | |
## Validation and setting variables | |
$gem_ensure = pick($gem_version, 'installed') | |
validate_absolute_path($gem_source) | |
validate_absolute_path($puppetserver_gem_dir) | |
# Set exec defaults for PE paths | |
Exec { | |
path => [ | |
'/opt/puppetlabs/server/bin', | |
'/opt/puppetlabs/puppet/bin', | |
'/opt/puppet/bin', | |
'/usr/bin', | |
'/bin', | |
], | |
} | |
# Install into puppetserver gem path with exec because you cannot | |
# manage two package resources with the same title or namevar | |
exec { "install puppetserver gem ${gem_name}": | |
command => "puppetserver gem install --local ${gem_path}", | |
unless => "find ${puppetserver_gem_dir} -mindepth 1 -maxdepth 1 -type d -exec basename {} \\; | egrep -q '^${gem_name}-([0-9].?)+$'", | |
} | |
# Install into PE gem path to be able to use functionality | |
package { $gem_name: | |
ensure => $gem_ensure, | |
provider => 'puppet_gem', | |
source => $gem_path, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment