server.pp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # == Class: icinga2::server
  2. #
  3. # This module installs and configures the server components for the Icinga 2 monitoring system.
  4. #
  5. # === Parameters
  6. #
  7. # Coming soon...
  8. #
  9. # === Examples
  10. #
  11. # Coming soon...
  12. #
  13. class icinga2::server (
  14. $manage_repos = $icinga2::params::manage_repos,
  15. $server_db_type = $icinga2::params::server_db_type,
  16. $db_name = $icinga2::params::db_name,
  17. $db_user = $icinga2::params::db_user,
  18. $db_password = $icinga2::params::db_password,
  19. $db_host = $icinga2::params::db_host,
  20. $package_provider = $icinga2::params::package_provider,
  21. $icinga2_server_package = $icinga2::params::icinga2_server_package,
  22. #$server_db_schema_path = $icinga2::params::server_db_schema_path
  23. $server_install_nagios_plugins = $icinga2::params::server_install_nagios_plugins,
  24. ) inherits icinga2::params {
  25. validate_bool($manage_repos)
  26. #Pick set the right path where we can find the DB schema based on the OS...
  27. case $operatingsystem {
  28. 'RedHat', 'CentOS': {
  29. #...and database that the user picks
  30. case $server_db_type {
  31. 'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' }
  32. 'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' }
  33. }
  34. }
  35. #Debian/Ubuntu systems:
  36. /^(Debian|Ubuntu)$/: {
  37. #Pick set the right path where we can find the DB schema
  38. case $server_db_type {
  39. 'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' }
  40. 'pgsql': { $server_db_schema_path = '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql' }
  41. }
  42. }
  43. #Fail if we're on any other OS:
  44. default: { fail("${operatingsystem} is not supported!") }
  45. }
  46. #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the
  47. #class left is applied before the class on the right and that it also refreshes the
  48. #class on the right.
  49. class {'icinga2::server::install':} ~>
  50. class {'icinga2::server::config':} ~>
  51. class {'icinga2::server::service':}
  52. }