Puppet Class: sensu::plugins
- Defined in:
- manifests/plugins.pp
Summary
Manage Sensu pluginsOverview
Class to manage the Sensu plugins.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 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 |
# File 'manifests/plugins.pp', line 38
class sensu::plugins (
Optional[Boolean] $manage_repo = undef,
String $package_ensure = 'installed',
String $package_name = 'sensu-plugins-ruby',
Array $dependencies = [],
Array $gem_dependencies = [],
Variant[Array, Hash] $plugins = [],
Variant[Array, Hash] $extensions = [],
) {
if $facts['os']['family'] == 'windows' {
fail('sensu::plugins is not supported on Windows')
}
include sensu
include sensu::common
$_manage_repo = pick($manage_repo, $sensu::manage_repo)
if $_manage_repo {
include sensu::repo::community
$package_require = [Class['sensu::repo::community']] + $sensu::os_package_require
} else {
$package_require = undef
}
package { 'sensu-plugins-ruby':
ensure => $package_ensure,
name => $package_name,
require => $package_require,
}
ensure_packages($dependencies)
$dependencies.each |$package| {
Package[$package] -> Sensu_plugin <| |> # lint:ignore:spaceship_operator_without_tag
}
ensure_packages($gem_dependencies, {'provider' => 'sensu_gem', 'require' => [Package[$dependencies],Package['sensu-plugins-ruby']]})
if $plugins =~ Array {
$plugins.each |$plugin| {
sensu_plugin { $plugin:
ensure => 'present',
}
}
} else {
$plugins.each |$plugin, $plugin_data| {
$data = { 'ensure' => 'present' } + $plugin_data
sensu_plugin { $plugin:
* => $data,
}
}
}
if $extensions =~ Array {
$extensions.each |$extension| {
sensu_plugin { $extension:
ensure => 'present',
extension => true,
}
}
} else {
$extensions.each |$extension, $extension_data| {
$data = { 'ensure' => 'present', 'extension' => true } + $extension_data
sensu_plugin { $extension:
* => $data,
}
}
}
}
|