Revision 33054bc5
Added by cristian falcas over 9 years ago
manifests/init.pp | ||
---|---|---|
# $version:: foreman package version, it's passed to ensure parameter of package resource
|
||
# can be set to specific version number, 'latest', 'present' etc.
|
||
#
|
||
# $plugin_version:: foreman plugins version, it's passed to ensure parameter of plugins package resource
|
||
# can be set to 'latest', 'present', 'installed', 'absent'.
|
||
#
|
||
# $port:: Port on which will foreman proxy listen
|
||
# type:integer
|
||
#
|
||
... | ... | |
$gpgcheck = $foreman_proxy::params::gpgcheck,
|
||
$custom_repo = $foreman_proxy::params::custom_repo,
|
||
$version = $foreman_proxy::params::version,
|
||
$plugin_version = $foreman_proxy::params::plugin_version,
|
||
$port = $foreman_proxy::params::port,
|
||
$dir = $foreman_proxy::params::dir,
|
||
$user = $foreman_proxy::params::user,
|
||
... | ... | |
validate_bool($ssl, $manage_sudoersd, $use_sudoersd, $register_in_foreman)
|
||
validate_array($trusted_hosts)
|
||
validate_re($log_level, '^(UNKNOWN|FATAL|ERROR|WARN|INFO|DEBUG)$')
|
||
validate_re($plugin_version, '^(installed|present|latest|absent)$')
|
||
|
||
# Validate puppet params
|
||
validate_bool($puppetca, $puppetrun, $puppetssh_wait)
|
manifests/params.pp | ||
---|---|---|
# set it to some custom location.
|
||
$custom_repo = false
|
||
$version = 'present'
|
||
$plugin_version = 'installed'
|
||
|
||
# variables
|
||
$port = '8443'
|
manifests/plugin.pp | ||
---|---|---|
# Installs a smart proxy plugin package
|
||
define foreman_proxy::plugin(
|
||
$version = $foreman_proxy::plugin_version,
|
||
$package = "${foreman_proxy::plugin_prefix}${title}",
|
||
) {
|
||
# Debian gem2deb converts underscores to hyphens
|
||
... | ... | |
}
|
||
}
|
||
package { $real_package:
|
||
ensure => installed,
|
||
ensure => $version,
|
||
}
|
||
}
|
manifests/plugin/abrt.pp | ||
---|---|---|
#
|
||
# $group:: group owner of the configuration file
|
||
#
|
||
# $version:: plugin package version, it's passed to ensure parameter of package resource
|
||
# can be set to specific version number, 'latest', 'present' etc.
|
||
#
|
||
# $enabled:: enables/disables the plugin
|
||
# type:boolean
|
||
#
|
||
... | ... | |
#
|
||
class foreman_proxy::plugin::abrt (
|
||
$enabled = $::foreman_proxy::plugin::abrt::params::enabled,
|
||
$version = undef,
|
||
$group = $::foreman_proxy::plugin::abrt::params::group,
|
||
$abrt_send_log_file = $::foreman_proxy::plugin::abrt::params::abrt_send_log_file,
|
||
$spooldir = $::foreman_proxy::plugin::abrt::params::spooldir,
|
||
... | ... | |
$faf_server_ssl_noverify = $::foreman_proxy::plugin::abrt::params::faf_server_ssl_noverify,
|
||
$faf_server_ssl_cert = $::foreman_proxy::plugin::abrt::params::faf_server_ssl_cert,
|
||
$faf_server_ssl_key = $::foreman_proxy::plugin::abrt::params::faf_server_ssl_key,
|
||
) inherits foreman_proxy::plugin::abrt::params {
|
||
) inherits foreman_proxy::plugin::abrt::params {
|
||
|
||
validate_bool($enabled)
|
||
validate_absolute_path($abrt_send_log_file)
|
||
validate_absolute_path($spooldir)
|
||
validate_bool($aggregate_reports)
|
||
validate_bool($faf_server_ssl_noverify)
|
||
$group_real = pick($group, $::foreman_proxy::user)
|
||
validate_string($group_real)
|
||
|
||
foreman_proxy::plugin { 'abrt': } ->
|
||
file { '/etc/foreman-proxy/settings.d/abrt.yml':
|
||
ensure => file,
|
||
content => template('foreman_proxy/plugin/abrt.yml.erb'),
|
||
owner => 'root',
|
||
group => $group_real,
|
||
mode => '0640',
|
||
foreman_proxy::plugin { 'abrt':
|
||
version => $version,
|
||
} ->
|
||
foreman_proxy::settings_file { 'abrt':
|
||
template_path => 'foreman_proxy/plugin/abrt.yml.erb',
|
||
group => $group,
|
||
}
|
||
}
|
manifests/plugin/pulp.pp | ||
---|---|---|
#
|
||
# $group:: group owner of the configuration file
|
||
#
|
||
# $version:: plugin package version, it's passed to ensure parameter of package resource
|
||
# can be set to specific version number, 'latest', 'present' etc.
|
||
#
|
||
# $enabled:: enables/disables the pulp plugin
|
||
# type:boolean
|
||
#
|
||
... | ... | |
class foreman_proxy::plugin::pulp (
|
||
$enabled = $::foreman_proxy::plugin::pulp::params::enabled,
|
||
$pulpnode_enabled = $::foreman_proxy::plugin::pulp::params::pulpnode_enabled,
|
||
$version = undef,
|
||
$group = $::foreman_proxy::plugin::pulp::params::group,
|
||
$pulp_url = $::foreman_proxy::plugin::pulp::params::pulp_url,
|
||
) inherits foreman_proxy::plugin::pulp::params {
|
||
... | ... | |
validate_bool($pulpnode_enabled)
|
||
|
||
foreman_proxy::plugin {'pulp':
|
||
version => $version,
|
||
} ->
|
||
foreman_proxy::settings_file { 'pulp':
|
||
template_path => 'foreman_proxy/plugin/pulp.yml.erb',
|
spec/defines/foreman_proxy_plugin_spec.rb | ||
---|---|---|
describe 'foreman_proxy::plugin' do
|
||
let :title do 'myplugin' end
|
||
|
||
context 'no parameters' do
|
||
let :pre_condition do
|
||
'include foreman_proxy'
|
||
end
|
||
let :pre_condition do
|
||
'include foreman_proxy'
|
||
end
|
||
|
||
let :facts do {
|
||
:concat_basedir => '/nonexistant',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
} end
|
||
let :facts do {
|
||
:concat_basedir => '/nonexistant',
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
} end
|
||
|
||
context 'no parameters' do
|
||
it 'should install the correct package' do
|
||
should contain_package('rubygem-smart_proxy_myplugin').with_ensure('installed')
|
||
end
|
||
... | ... | |
end
|
||
end
|
||
|
||
context 'with version parameter' do
|
||
let :params do {
|
||
:version => 'latest',
|
||
} end
|
||
|
||
it 'should install the correct package' do
|
||
should contain_package('rubygem-smart_proxy_myplugin').with_ensure('latest')
|
||
end
|
||
end
|
||
|
||
context 'when handling underscores on Red Hat' do
|
||
let :params do {
|
||
:package => 'my_fun_plugin',
|
Also available in: Unified diff
add version for plugins