Revision 27af4444
Added by Ewoud Kohl van Wijngaarden over 10 years ago
manifests/params.pp | ||
---|---|---|
$puppet_basedir = '/usr/share/ruby/vendor_ruby/puppet'
|
||
$yumcode = "f${::operatingsystemrelease}"
|
||
$passenger_scl = undef
|
||
$plugin_prefix = 'rubygem-foreman_'
|
||
}
|
||
default: {
|
||
$puppet_basedir = regsubst($::rubyversion, '^(\d+\.\d+).*$', '/usr/lib/ruby/site_ruby/\1/puppet')
|
||
$yumcode = regsubst($::operatingsystemrelease, '^(\d+)\..*$', 'el\1')
|
||
# add passenger::install::scl as EL uses SCL on Foreman 1.2+
|
||
$passenger_scl = 'ruby193'
|
||
$plugin_prefix = 'ruby193-rubygem-foreman_'
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
$puppet_basedir = '/usr/lib/ruby/vendor_ruby/puppet'
|
||
$apache_conf_dir = '/etc/apache2/conf.d'
|
||
$passenger_scl = undef
|
||
$plugin_prefix = 'ruby-foreman-'
|
||
}
|
||
Linux: {
|
||
case $::operatingsystem {
|
||
... | ... | |
$yumcode = 'el6'
|
||
# add passenger::install::scl as EL uses SCL on Foreman 1.2+
|
||
$passenger_scl = 'ruby193'
|
||
$plugin_prefix = 'ruby193-rubygem-foreman_'
|
||
}
|
||
default: {
|
||
fail("${::hostname}: This module does not support operatingsystem ${::operatingsystem}")
|
manifests/plugin.pp | ||
---|---|---|
define foreman::plugin(
|
||
$package = "${foreman::plugin_prefix}${title}"
|
||
) {
|
||
package { $package:
|
||
ensure => installed,
|
||
notify => Class['foreman::service'],
|
||
}
|
||
}
|
manifests/plugin/puppetdb.pp | ||
---|---|---|
class foreman::plugin::puppetdb {
|
||
case $::osfamily {
|
||
RedHat: {
|
||
case $::operatingsystem {
|
||
fedora: {
|
||
$package = 'rubygem-puppetdb_foreman'
|
||
}
|
||
default: {
|
||
$package = 'ruby193-rubygem-puppetdb_foreman'
|
||
}
|
||
}
|
||
}
|
||
Debian: {
|
||
$package = 'ruby-puppetdb_foreman'
|
||
}
|
||
Linux: {
|
||
case $::operatingsystem {
|
||
Amazon: {
|
||
$package = 'ruby193-rubygem-puppetdb_foreman'
|
||
}
|
||
default: {
|
||
fail("${::hostname}: puppetdb_foreman does not support operatingsystem ${::operatingsystem}")
|
||
}
|
||
}
|
||
}
|
||
default: {
|
||
fail("${::hostname}: puppetdb_foreman does not support osfamily ${::osfamily}")
|
||
}
|
||
}
|
||
|
||
foreman::plugin {'puppetdb':
|
||
package => $package,
|
||
}
|
||
}
|
manifests/plugin/templates.pp | ||
---|---|---|
class foreman::plugin::templates {
|
||
foreman::plugin {'templates':
|
||
}
|
||
}
|
spec/classes/foreman_plugin_puppetdb_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'foreman::plugin::puppetdb' do
|
||
let :facts do {
|
||
:osfamily => 'Debian',
|
||
} end
|
||
|
||
it 'should call the plugin' do
|
||
should contain_foreman__plugin('puppetdb').with_package('ruby-puppetdb_foreman')
|
||
end
|
||
end
|
||
|
spec/classes/foreman_plugin_templates_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'foreman::plugin::templates' do
|
||
it 'should call the plugin' do
|
||
should contain_foreman__plugin('templates')
|
||
end
|
||
end
|
spec/defines/foreman_plugin_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'foreman::plugin' do
|
||
let :title do 'myplugin' end
|
||
|
||
context 'no parameters' do
|
||
let :pre_condition do
|
||
'include foreman'
|
||
end
|
||
|
||
let :facts do {
|
||
:concat_basedir => '/nonexistant',
|
||
:osfamily => 'RedHat',
|
||
:postgres_default_version => '8.4',
|
||
} end
|
||
|
||
it 'should install the correct package with notify' do
|
||
should contain_package('ruby193-rubygem-foreman_myplugin').with({
|
||
:ensure => 'installed',
|
||
:notify => 'Class[Foreman::Service]',
|
||
})
|
||
end
|
||
end
|
||
|
||
context 'with package parameter' do
|
||
let :params do {
|
||
:package => 'myplugin',
|
||
} end
|
||
|
||
it 'should install the correct package with notify' do
|
||
should contain_package('myplugin').with({
|
||
:ensure => 'installed',
|
||
:notify => 'Class[Foreman::Service]',
|
||
})
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
Enable installation of plugins