diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..77b3415 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,59 @@ +# == Class: icinga2::params +# +# This class contains config options and settings for use elsewhere in the module. +# +# === Parameters +# +# See the inline comments. +# + +class icinga2::params { + + ############################## + # Package parameters + ############################## + + #Whether to manage the package repositories + $manage_repos = 'true' + + ############################## + # Icinga 2 server package parameters + + $server_db_type = 'pgsql' + + case $operatingsystem { + #Red Hat/CentOS systems: + 'RedHat', 'CentOS': { + #Pick the right package provider: + $package_provider = 'yum' + #Icinga 2 server package + $icinga2_server_package = 'icinga2' + } + + #Debian/Ubuntu systems: + /^(Debian|Ubuntu)$/: { + #Pick the right package provider: + $package_provider = 'apt' + #Icinga 2 server package + $icinga2_server_package = 'icinga2' + + #Set some package repo variables based on the Ubuntu release: + case $operatingsystemrelease { + #For Ubuntu 12.04 Precise Pangolin: http://releases.ubuntu.com/12.04/ + '12.04': { + + } + #For Ubuntu 14.04 Trusty Tahr: http://releases.ubuntu.com/14.04/ + '14.04': { + + } + #Fail if we are on any other Ubuntu release: + default: { fail("${operatingsystem} ${operatingsystemrelease} is not a supported Ubuntu release!") } + } + } + + #Fail if we're on any other OS: + default: { fail("${operatingsystem} is not supported!") } + } + +} \ No newline at end of file diff --git a/manifests/server.pp b/manifests/server.pp new file mode 100644 index 0000000..d379123 --- /dev/null +++ b/manifests/server.pp @@ -0,0 +1,25 @@ +# == Class: icinga2::server +# +# This module installs and configures the server components for the Icinga 2 monitoring system. +# +# === Parameters +# +# Coming soon... +# +# === Examples +# +# Coming soon... +# + +class icinga2::server ( + $server_db_type = $icinga2::params::server_db_type +) inherits icinga2::params { + + #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the + #class left is applied before the class on the right and that it also refreshes the + #class on the right. + class {'icinga2::server::install':} #~> + #class {'icinga2::server::config':} ~> + #class {'icinga2::server::service':} + +} \ No newline at end of file diff --git a/manifests/server/config.pp b/manifests/server/config.pp new file mode 100644 index 0000000..fbdeb4b --- /dev/null +++ b/manifests/server/config.pp @@ -0,0 +1,18 @@ +# == Class: icinga2::server::config +# +# This class configures the server components for the Icinga 2 monitoring system. +# +# === Parameters +# +# Coming soon... +# +# === Examples +# +# Coming soon... +# + +class icinga2::server::config inherits icinga2::server { + + include icinga2::params + +} \ No newline at end of file diff --git a/manifests/server/install.pp b/manifests/server/install.pp new file mode 100644 index 0000000..d1c92e4 --- /dev/null +++ b/manifests/server/install.pp @@ -0,0 +1,45 @@ +# == Class: icinga2::server::install +# +# This class installs the server components for the Icinga 2 monitoring system. +# +# === Parameters +# +# Coming soon... +# +# === Examples +# +# Coming soon... +# + +class icinga2::server::install inherits icinga2::server { + + include icinga2::params + #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the + #class left is applied before the class on the right and that it also refreshes the + #class on the right. + # + #Here, we're setting up the package repos first, then installing the packages: + class{'icinga2::server::install::repos':} ~> + class{'icinga2::server::install::packages':} ~> + class{'icinga2::server::install::execs':} -> + Class['icinga2::server::install'] + +} + +class icinga2::server::install::repos inherits icinga2::server { + + include icinga2::params + +} + +class icinga2::server::install::packages inherits icinga2::server { + + include icinga2::params + +} + +class icinga2::server::install::execs inherits icinga2::server { + + include icinga2::params + +} \ No newline at end of file diff --git a/manifests/server/service.pp b/manifests/server/service.pp new file mode 100644 index 0000000..c930c77 --- /dev/null +++ b/manifests/server/service.pp @@ -0,0 +1,18 @@ +# == Class: icinga2::server::service +# +# This class mangages the daemons of the server components for the Icinga 2 monitoring system. +# +# === Parameters +# +# Coming soon... +# +# === Examples +# +# Coming soon... +# + +class icinga2::server::service inherits icinga2::server { + + include icinga2::params + +} \ No newline at end of file