Puppet Class: psick::puppet::gems
- Defined in:
- manifests/puppet/gems.pp
Overview
This class installs the gems needed to run Puppet with this control-repo It can be also be used to install any gem on any gem environment (Puppet, PuppetServer, System, RBenv…).
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'manifests/puppet/gems.pp', line 61
class psick::puppet::gems (
Enum['present','absent'] $ensure = 'present',
Enum['none','client','master','developer','citest','cideploy','integration'] $default_set = 'none',
Array $install_gems = [],
Array $install_options = [],
Boolean $install_system_gems = false,
Boolean $install_puppet_gems = true,
Boolean $install_puppetserver_gems = false,
Boolean $install_rbenv_gems = false,
Boolean $install_chruby_gems = false,
Array $additional_system_gems = [],
Array $additional_puppet_gems = [],
Array $additional_puppetserver_gems = [],
Array $additional_rbenv_gems = [],
Array $additional_chruby_gems = [],
Optional[String] $rbenv_ruby_version = undef,
Optional[String] $chruby_ruby_version = undef,
Boolean $auto_prereq = $psick::auto_prereq,
Boolean $manage = $psick::manage,
Boolean $noop_manage = $psick::noop_manage,
Boolean $noop_value = $psick::noop_value,
) {
if $manage {
if $noop_manage {
noop($noop_value)
}
$minimal_gems = ['r10k','hiera-eyaml','deep_merge']
$minimal_test_gems = ['puppet-lint','rspec-puppet','rake','bundler','simplecov','minitest','puppetlabs_spec_helper','yaml-lint'] # lint:ignore:140chars
$default_gems = $default_set ? {
'none' => [],
'client' => [],
'master' => $minimal_gems,
'cideploy' => $minimal_gems + $minimal_test_gems,
'citest' => $minimal_gems + $minimal_test_gems,
'integration' => $minimal_gems + $minimal_test_gems + ['beaker','beaker-rspec','beaker-puppet_install_helper'],
'developer' => $minimal_gems + $minimal_test_gems + ['puppet-debug','puppet-blacksmith','puppet-ghostbuster'],
}
$all_gems = $default_gems + $install_gems
if $install_system_gems {
if $auto_prereq {
include psick::ruby
}
$system_gems = $all_gems + $additional_system_gems
$system_gems.each | $gem | {
package { $gem:
ensure => $ensure,
install_options => $install_options,
provider => 'gem',
require => Class['psick::ruby'],
}
}
}
if $install_puppet_gems {
if $auto_prereq {
include psick::ruby::buildgems
}
$puppet_gems = $all_gems + $additional_puppet_gems
$puppet_gems.each | $gem | {
if !defined(Class['r10k']) {
package { "puppet_${gem}":
ensure => $ensure,
name => $gem,
install_options => $install_options,
provider => 'puppet_gem',
require => Class['psick::ruby::buildgems'],
}
}
}
}
if $install_puppetserver_gems {
$puppetserver_gems = $all_gems + $additional_puppetserver_gems
$puppetserver_gems.each | $gem | {
package { "puppetserver_${gem}":
ensure => $ensure,
name => $gem,
install_options => $install_options,
provider => 'puppetserver_gem',
}
}
}
if $install_rbenv_gems {
if $auto_prereq {
include psick::ruby::rbenv
}
$rbenv_require = $auto_prereq ? {
true => Class['psick::ruby::rbenv'],
false => undef,
}
$rbenv_gems = $all_gems + $additional_rbenv_gems
$rbenv_gems.each | $gem | {
# bundler gem already installed by rbenv module
if $gem != 'bundler' {
rbenv::gem { $gem:
ruby_version => pick($rbenv_ruby_version,$psick::ruby::rbenv::default_ruby_version),
skip_docs => true,
require => $rbenv_require,
}
}
}
}
if $install_chruby_gems {
if $auto_prereq {
include psick::chruby
}
$chruby_require = $auto_prereq ? {
true => Class['psick::chruby'],
false => undef,
}
$chruby_gems = $all_gems + $additional_chruby_gems
$chruby_gems.each | $gem | {
psick::chruby::gem { $gem:
ruby_version => pick($chruby_ruby_version,$psick::chruby::default_ruby_version),
require => $chruby_require,
}
}
}
}
}
|