diff --git a/manifests/module/businessprocess.pp b/manifests/module/businessprocess.pp index ccece96..fffb049 100644 --- a/manifests/module/businessprocess.pp +++ b/manifests/module/businessprocess.pp @@ -1,26 +1,37 @@ # == Class: icingaweb2::module::businessprocess # # Install and enable the businessprocess module. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # # [*git_repository*] # Set a git repository URL. Defaults to github. # # [*git_revision*] # Set either a branch or a tag name, eg. `master` or `v2.1.0`. # +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-businessprocess` +# class icingaweb2::module::businessprocess( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-businessprocess.git', - Optional[String] $git_revision = undef, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-businessprocess.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-businessprocess', ){ icingaweb2::module {'businessprocess': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } } diff --git a/manifests/module/cube.pp b/manifests/module/cube.pp index 97221cd..df6ae05 100644 --- a/manifests/module/cube.pp +++ b/manifests/module/cube.pp @@ -1,26 +1,37 @@ # == Class: icingaweb2::module::cube # # Install and enable the cube module. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # # [*git_repository*] # Set a git repository URL. Defaults to github. # # [*git_revision*] # Set either a branch or a tag name, eg. `master` or `v1.0.0`. # +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-cube` +# class icingaweb2::module::cube( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-cube.git', - Optional[String] $git_revision = undef, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-cube.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-cube', ){ icingaweb2::module {'cube': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } } diff --git a/manifests/module/director.pp b/manifests/module/director.pp index 3d8f7ca..cc842c2 100644 --- a/manifests/module/director.pp +++ b/manifests/module/director.pp @@ -1,145 +1,156 @@ # == Class: icingaweb2::module::director # # Install and configure the director module. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # # [*git_repository*] # Set a git repository URL. Defaults to github. # # [*git_revision*] # Set either a branch or a tag name, eg. `master` or `v1.3.2`. # +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-director` +# # [*db_type*] # Type of your database. Either `mysql` or `pgsql`. Defaults to `mysql` # # [*db_host*] # Hostname of the database. # # [*db_port*] # Port of the database. Defaults to `3306` # # [*db_name*] # Name of the database. # # [*db_username*] # Username for DB connection. # # [*db_password*] # Password for DB connection. # # [*import_schema*] # Import database schema. Defaults to `false` # # [*kickstart*] # Run kickstart command after database migration. This requires `import_schema` to be `true`. Defaults to `false` # # [*endpoint*] # Endpoint object name of Icinga 2 API. This setting is only valid if `kickstart` is `true`. # # [*api_host*] # Icinga 2 API hostname. This setting is only valid if `kickstart` is `true`. Defaults to `localhost` # # [*api_port*] # Icinga 2 API port. This setting is only valid if `kickstart` is `true`. Defaults to `5665` # # [*api_username*] # Icinga 2 API username. This setting is only valid if `kickstart` is `true`. # # [*api_password*] # Icinga 2 API password. This setting is only valid if `kickstart` is `true`. # class icingaweb2::module::director( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-director.git', - Optional[String] $git_revision = undef, - Enum['mysql', 'pgsql'] $db_type = 'mysql', - Optional[String] $db_host = undef, - Integer[1,65535] $db_port = 3306, - Optional[String] $db_name = undef, - Optional[String] $db_username = undef, - Optional[String] $db_password = undef, - Optional[String] $db_charset = 'utf8', - Optional[Boolean] $import_schema = false, - Optional[Boolean] $kickstart = false, - Optional[String] $endpoint = undef, - String $api_host = 'localhost', - Integer[1,65535] $api_port = 5665, - Optional[String] $api_username = undef, - Optional[String] $api_password = undef, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-director.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-director', + Enum['mysql', 'pgsql'] $db_type = 'mysql', + Optional[String] $db_host = undef, + Integer[1,65535] $db_port = 3306, + Optional[String] $db_name = undef, + Optional[String] $db_username = undef, + Optional[String] $db_password = undef, + Optional[String] $db_charset = 'utf8', + Optional[Boolean] $import_schema = false, + Optional[Boolean] $kickstart = false, + Optional[String] $endpoint = undef, + String $api_host = 'localhost', + Integer[1,65535] $api_port = 5665, + Optional[String] $api_username = undef, + Optional[String] $api_password = undef, ){ $conf_dir = $::icingaweb2::params::conf_dir $module_conf_dir = "${conf_dir}/modules/director" Exec { user => 'root', path => $::path, } icingaweb2::config::resource { 'icingaweb2-module-director': type => 'db', db_type => $db_type, host => $db_host, port => $db_port, db_name => $db_name, db_username => $db_username, db_password => $db_password, db_charset => $db_charset, } $db_settings = { 'module-director-db' => { 'section_name' => 'db', 'target' => "${module_conf_dir}/config.ini", 'settings' => { 'resource' => 'icingaweb2-module-director' } } } if $import_schema { ensure_packages(['icingacli'], { 'ensure' => 'present' }) exec { 'director-migration': command => 'icingacli director migration run', onlyif => 'icingacli director migration pending', require => [ Package['icingacli'], Icingaweb2::Module['director'] ] } if $kickstart { $kickstart_settings = { 'module-director-config' => { 'section_name' => 'config', 'target' => "${module_conf_dir}/kickstart.ini", 'settings' => { 'endpoint' => $endpoint, 'host' => $api_host, 'port' => $api_port, 'username' => $api_username, 'password' => $api_password, } } } exec { 'director-kickstart': command => 'icingacli director kickstart run', onlyif => 'icingacli director kickstart required', require => Exec['director-migration'] } } else { $kickstart_settings = {} } } else { $kickstart_settings = {} } icingaweb2::module {'director': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, settings => merge($db_settings, $kickstart_settings), } } diff --git a/manifests/module/elasticsearch.pp b/manifests/module/elasticsearch.pp index 51c0433..1793bb3 100644 --- a/manifests/module/elasticsearch.pp +++ b/manifests/module/elasticsearch.pp @@ -1,55 +1,72 @@ # == Class: icingaweb2::module::elasticsearch # # The Elasticsearch module displays events from data stored in Elasticsearch. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # +# [*git_repository*] +# Set a git repository URL. Defaults to github. +# +# [*git_revision*] +# Set either a branch or a tag name, eg. `master` or `v1.3.2`. +# +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-elasticsearch` +# # [*instances*] # A hash that configures one or more Elasticsearch instances that this module connects to. The defined type # `icingaweb2::module::elasticsearch::instance` is used to create the instance configuration. # # [*eventtypes*] # A hash oft ypes of events that should be displayed. Event types are always connected to instances. The defined type # `icingaweb2::module::elasticsearch::eventtype` is used to create the event types. # class icingaweb2::module::elasticsearch( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-elasticsearch.git', - Optional[String] $git_revision = undef, - Optional[Hash] $instances = undef, - Optional[Hash] $eventtypes = undef, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-elasticsearch.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-elasticsearch', + Optional[Hash] $instances = undef, + Optional[Hash] $eventtypes = undef, ){ if $instances { $instances.each |$name, $setting| { icingaweb2::module::elasticsearch::instance{ $name: uri => $setting['uri'], user => $setting['user'], password => $setting['password'], ca => $setting['ca'], client_certificate => $setting['client_certificate'], client_private_key => $setting['client_private_key'], } } } if $eventtypes { $eventtypes.each |$name, $setting| { icingaweb2::module::elasticsearch::eventtype { $name: instance => $setting['instance'], index => $setting['index'], filter => $setting['filter'], fields => $setting['fields'], } } } icingaweb2::module { 'elasticsearch': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } -} \ No newline at end of file +} diff --git a/manifests/module/fileshipper.pp b/manifests/module/fileshipper.pp index d2b58a7..333d514 100644 --- a/manifests/module/fileshipper.pp +++ b/manifests/module/fileshipper.pp @@ -1,50 +1,67 @@ # == Class: icingaweb2::module::fileshipper # # The fileshipper module extends the Director. It offers import sources to deal with CSV, JSON, YAML and XML files. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # +# [*git_repository*] +# Set a git repository URL. Defaults to github. +# +# [*git_revision*] +# Set either a branch or a tag name, eg. `master` or `v1.3.2`. +# +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-fileshipper` +# # [*base_directories*] # Hash of base directories. These directories can later be selected in the import source (Director). # # [*directories*] # Deploy plain Icinga 2 configuration files through the Director to your Icinga 2 master. # class icingaweb2::module::fileshipper( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-fileshipper.git', - Optional[String] $git_revision = undef, - Hash $base_directories = {}, - Hash $directories = {}, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-fileshipper.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-fileshipper', + Hash $base_directories = {}, + Hash $directories = {}, ){ $conf_dir = $::icingaweb2::params::conf_dir $module_conf_dir = "${conf_dir}/modules/fileshipper" if $base_directories { $base_directories.each |$identifier, $directory| { icingaweb2::module::fileshipper::basedir{$identifier: basedir => $directory, } } } if $directories { $directories.each |$identifier, $settings| { icingaweb2::module::fileshipper::directory{$identifier: source => $settings['source'], target => $settings['target'], extensions => $settings['extensions'], } } } icingaweb2::module { 'fileshipper': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } } diff --git a/manifests/module/generictts.pp b/manifests/module/generictts.pp index 05f12ff..9e95bda 100644 --- a/manifests/module/generictts.pp +++ b/manifests/module/generictts.pp @@ -1,42 +1,53 @@ # == Class: icingaweb2::module::generictts # # Install and enable the generictts module. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # # [*git_repository*] # Set a git repository URL. Defaults to github. # # [*git_revision*] # Set either a branch or a tag name, eg. `master` or `v2.0.0`. # +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-generictts` +# # [*ticketsystems*] # A hash of ticketsystems. The hash expects a `patten` and a `url` for each ticketsystem. The regex pattern is to # match the ticket ID, eg. `/#([0-9]{4,6})/`. Place the ticket ID in the URL, eg. # `https://my.ticket.system/tickets/id=$1` # # Example: # ticketsystems => { # system1 => { # pattern => '/#([0-9]{4,6})/', # url => 'https://my.ticket.system/tickets/id=$1' # } # } # class icingaweb2::module::generictts( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-generictts.git', - Optional[String] $git_revision = undef, - Hash $ticketsystems = {}, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-generictts.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-generictts', + Hash $ticketsystems = {}, ){ create_resources('icingaweb2::module::generictts::ticketsystem', $ticketsystems) icingaweb2::module {'generictts': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } } diff --git a/manifests/module/graphite.pp b/manifests/module/graphite.pp index a95d535..e62e73a 100644 --- a/manifests/module/graphite.pp +++ b/manifests/module/graphite.pp @@ -1,69 +1,86 @@ # == Class: icingaweb2::module::graphite # # The Graphite module draws graphs out of time series data stored in Graphite. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # +# [*git_repository*] +# Set a git repository URL. Defaults to github. +# +# [*git_revision*] +# Set either a branch or a tag name, eg. `master` or `v2.0.0`. +# +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-graphite` +# # [*url*] # URL to your Graphite Web # # [*user*] # A user with access to your Graphite Web via HTTP basic authentication # # [*password*] # The users password # # [*graphite_writer_host_name_template*] # The value of your Icinga 2 GraphiteWriter's attribute `host_name_template` (if specified) # # [*graphite_writer_service_name_template*] # The value of your icinga 2 GraphiteWriter's attribute `service_name_template` (if specified) # class icingaweb2::module::graphite( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-graphite.git', - Optional[String] $git_revision = undef, - Optional[String] $url = undef, - Optional[String] $user = undef, - Optional[String] $password = undef, - Optional[String] $graphite_writer_host_name_template = undef, - Optional[String] $graphite_writer_service_name_template = undef + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-graphite.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-graphite', + Optional[String] $url = undef, + Optional[String] $user = undef, + Optional[String] $password = undef, + Optional[String] $graphite_writer_host_name_template = undef, + Optional[String] $graphite_writer_service_name_template = undef ){ $conf_dir = $::icingaweb2::params::conf_dir $module_conf_dir = "${conf_dir}/modules/graphite" $graphite_settings = { 'url' => $url, 'user' => $user, 'password' => $password, } $icinga_settings = { 'graphite_writer_host_name_template' => $graphite_writer_host_name_template, 'graphite_writer_service_name_template' => $graphite_writer_service_name_template, } $settings = { 'module-graphite-graphite' => { 'section_name' => 'graphite', 'target' => "${module_conf_dir}/config.ini", 'settings' => delete_undef_values($graphite_settings) }, 'module-graphite-icinga' => { 'section_name' => 'icinga', 'target' => "${module_conf_dir}/config.ini", 'settings' => delete_undef_values($icinga_settings) } } icingaweb2::module { 'graphite': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, settings => $settings, } -} \ No newline at end of file +} diff --git a/manifests/module/puppetdb.pp b/manifests/module/puppetdb.pp index 0827d67..a674eb5 100644 --- a/manifests/module/puppetdb.pp +++ b/manifests/module/puppetdb.pp @@ -1,110 +1,121 @@ # == Define: icingaweb2::module::puppetdb # # Install and configure the puppetdb module. It is possible to let the module # to configure the ssl certificates to connect to one or more PuppetDBs. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # # [*git_repository*] # Set a git repository URL. Defaults to github. # # [*git_revision*] # Set either a branch or a tag name, eg. `master` or `v1.3.2`. # +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-puppetdb` +# # [*ssl*] # How to set up ssl certificates. To copy certificates from the local puppet installation, use `puppet`. Defaults to # `none` # # [*host*] # Hostname of the server where PuppetDB is running. The `ssl` parameter needs to be set to `puppet`. # # [*certificates*] # Hash with icingaweb2::module::puppetdb::certificate resources. # class icingaweb2::module::puppetdb( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-puppetdb.git', - Optional[String] $git_revision = undef, - Enum['none', 'puppet'] $ssl = 'none', - Optional[String] $host = undef, - Hash $certificates = {}, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-puppetdb.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-puppetdb', + Enum['none', 'puppet'] $ssl = 'none', + Optional[String] $host = undef, + Hash $certificates = {}, ){ $conf_dir = "${::icingaweb2::params::conf_dir}/modules/puppetdb" $ssl_dir = "${conf_dir}/ssl" $conf_user = $::icingaweb2::conf_user $conf_group = $::icingaweb2::params::conf_group file { $ssl_dir: ensure => 'directory', group => $conf_group, owner => $conf_user, mode => '2740', purge => true, force => true, recurse => true, } case $ssl { 'puppet': { $puppetdb_ssldir = "${ssl_dir}/${host}" file { [$puppetdb_ssldir, "${puppetdb_ssldir}/private_keys", "${puppetdb_ssldir}/certs"]: ensure => 'directory', group => $conf_group, owner => $conf_user, mode => '2740', purge => true, force => true, recurse => true, } file { "${puppetdb_ssldir}/certs/ca.pem": ensure => 'present', group => $conf_group, owner => $conf_user, mode => '0640', source => "${::settings::ssldir}/certs/ca.pem", } $combinedkey_path = "${puppetdb_ssldir}/private_keys/${::fqdn}_combined.pem" - notice("${::settings::ssldir}") + notice($::settings::ssldir) concat { $combinedkey_path: ensure => present, warn => false, owner => $conf_user, group => $conf_group, mode => '0640', ensure_newline => true, } concat::fragment { 'private_key': target => $combinedkey_path, source => "${::settings::ssldir}/private_keys/${::fqdn}.pem", order => 1, } concat::fragment { 'public_key': target => $combinedkey_path, source => "${::settings::ssldir}/certs/${::fqdn}.pem", order => 2, } } # puppet 'none': { } default: { } } # case ssl create_resources('icingaweb2::module::puppetdb::certificate',$certificates) icingaweb2::module {'puppetdb': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } } diff --git a/manifests/module/vsphere.pp b/manifests/module/vsphere.pp index af0d5fb..0cae114 100644 --- a/manifests/module/vsphere.pp +++ b/manifests/module/vsphere.pp @@ -1,23 +1,40 @@ # == Class: icingaweb2::module::vsphere # # The vSphere module extends the Director. It provides import sources for virtual machines and physical hosts # from vSphere. # # === Parameters # # [*ensure*] # Enable or disable module. Defaults to `present` # +# [*git_repository*] +# Set a git repository URL. Defaults to github. +# +# [*git_revision*] +# Set either a branch or a tag name, eg. `master` or `v1.3.2`. +# +# [*install_method*] +# Install methods are `git`, `package` and `none` is supported as installation method. Defaults to `git` +# +# [*package_name*] +# Package name of the module. This setting is only valid in combination with the installation method `package`. +# Defaults to `icingaweb2-module-vsphere` +# # class icingaweb2::module::vsphere( - Enum['absent', 'present'] $ensure = 'present', - String $git_repository = 'https://github.com/Icinga/icingaweb2-module-vsphere.git', - Optional[String] $git_revision = undef, + Enum['absent', 'present'] $ensure = 'present', + String $git_repository = 'https://github.com/Icinga/icingaweb2-module-vsphere.git', + Optional[String] $git_revision = undef, + Enum['git', 'none', 'package'] $install_method = 'git', + Optional[String] $package_name = 'icingaweb2-module-vsphere', ){ icingaweb2::module { 'vsphere': ensure => $ensure, git_repository => $git_repository, git_revision => $git_revision, + install_method => $install_method, + package_name => $package_name, } -} \ No newline at end of file +}