server.pp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #Pick set the right path where we can find the DB schema based on the OS...
  26. case $operatingsystem {
  27. 'RedHat', 'CentOS': {
  28. #...and database that the user picks
  29. case $server_db_type {
  30. 'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' }
  31. 'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' }
  32. }
  33. }
  34. #Debian/Ubuntu systems:
  35. /^(Debian|Ubuntu)$/: {
  36. #Pick set the right path where we can find the DB schema
  37. case $server_db_type {
  38. 'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' }
  39. 'pgsql': { $server_db_schema_path = '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql' }
  40. }
  41. }
  42. #Fail if we're on any other OS:
  43. default: { fail("${operatingsystem} is not supported!") }
  44. }
  45. #Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the
  46. #class left is applied before the class on the right and that it also refreshes the
  47. #class on the right.
  48. class {'icinga2::server::install':} ~>
  49. class {'icinga2::server::config':} ~>
  50. class {'icinga2::server::service':}
  51. }