Defined Type: icingaweb2::module
- Defined in:
- manifests/module.pp
Summary
Download, enable and configure Icinga Web 2 modules.Overview
Note:
If you want to use ‘git` as `install_method`, the CLI `git` command has to be installed. You can manage it yourself as package resource or declare the package name in icingaweb2 class parameter `extra_packages`.
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 108 109 110 111 112 |
# File 'manifests/module.pp', line 52
define icingaweb2::module (
Enum['absent', 'present'] $ensure = 'present',
String $module = $title,
Stdlib::Absolutepath $module_dir = "${icingaweb2::globals::default_module_path}/${title}",
Enum['git', 'none', 'package'] $install_method = 'git',
Optional[String] $git_repository = undef,
String $git_revision = 'master',
Optional[String] $package_name = undef,
Hash $settings = {},
) {
require icingaweb2
$conf_dir = $icingaweb2::globals::conf_dir
$state_dir = $icingaweb2::globals::state_dir
$conf_user = $icingaweb2::conf_user
$conf_group = $icingaweb2::conf_group
$enable_module = if $ensure == 'present' {
'link'
} else {
'absent'
}
file {
default:
owner => $conf_user,
group => $conf_group,
;
"${conf_dir}/enabledModules/${module}":
ensure => $enable_module,
target => $module_dir,
;
["${conf_dir}/modules/${module}", "${state_dir}/${module}"]:
ensure => directory,
owner => 'root',
mode => '2770',
;
}
create_resources('icingaweb2::inisection', $settings)
case $install_method {
'none': {}
'git': {
vcsrepo { $module_dir:
ensure => present,
provider => 'git',
source => $git_repository,
revision => $git_revision,
}
}
'package': {
package { $package_name:
ensure => installed,
}
}
default: {
fail('The installation method you provided is not supported.')
}
}
}
|