config.pp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. # == Class icingaweb2::config
  2. #
  3. class icingaweb2::config {
  4. if is_function_available('assert_private') {
  5. assert_private()
  6. } else {
  7. private()
  8. }
  9. @user { 'icingaweb2':
  10. ensure => present,
  11. home => $::icingaweb2::web_root,
  12. managehome => true,
  13. }
  14. @group { 'icingaweb2':
  15. ensure => present,
  16. system => true,
  17. }
  18. realize(User['icingaweb2'])
  19. realize(Group['icingaweb2'])
  20. File {
  21. require => Class['::icingaweb2::install'],
  22. owner => $::icingaweb2::config_user,
  23. group => $::icingaweb2::config_group,
  24. mode => $::icingaweb2::config_file_mode,
  25. }
  26. file {
  27. $::icingaweb2::config_dir:
  28. ensure => directory,
  29. mode => $::icingaweb2::config_dir_mode,
  30. recurse => $::icingaweb2::config_dir_recurse;
  31. "${::icingaweb2::config_dir}/enabledModules":
  32. ensure => directory,
  33. mode => $::icingaweb2::config_dir_mode;
  34. "${::icingaweb2::config_dir}/modules":
  35. ensure => directory,
  36. mode => $::icingaweb2::config_dir_mode;
  37. "${::icingaweb2::config_dir}/authentication.ini":
  38. ensure => present;
  39. "${::icingaweb2::config_dir}/config.ini":
  40. ensure => present;
  41. "${::icingaweb2::config_dir}/resources.ini":
  42. ensure => present;
  43. "${::icingaweb2::config_dir}/roles.ini":
  44. ensure => present;
  45. $::icingaweb2::web_root:
  46. ensure => directory,
  47. mode => $::icingaweb2::config_dir_mode;
  48. }
  49. # Configure authentication.ini settings
  50. icingaweb2::config::authentication_database { 'Local Database Authenticaiton':
  51. auth_section => 'icingaweb2',
  52. auth_resource => "${::icingaweb2::auth_resource}",
  53. }
  54. # Configure config.ini settings
  55. Ini_Setting {
  56. ensure => present,
  57. require => File["${::icingaweb2::config_dir}/config.ini"],
  58. path => "${::icingaweb2::config_dir}/config.ini",
  59. }
  60. # Logging Configuration
  61. ini_setting { 'icingaweb2 config logging method':
  62. section => 'logging',
  63. setting => 'log',
  64. value => "\"${::icingaweb2::log_method}\"",
  65. }
  66. ini_setting { 'icingaweb2 config logging level':
  67. section => 'logging',
  68. setting => 'level',
  69. value => "\"${::icingaweb2::log_level}\"",
  70. }
  71. ini_setting { 'icingaweb2 config logging application':
  72. section => 'logging',
  73. setting => 'application',
  74. value => "\"${::icingaweb2::log_application}\"",
  75. }
  76. # Preferences Configuration
  77. ini_setting { 'icingaweb2 config preferences store':
  78. section => 'preferences',
  79. setting => 'store',
  80. value => "\"${::icingaweb2::log_store}\"",
  81. }
  82. ini_setting { 'icingaweb2 config preferences resource':
  83. section => 'preferences',
  84. setting => 'resource',
  85. value => "\"${::icingaweb2::log_resource}\"",
  86. }
  87. # Configure resources.ini
  88. icingaweb2::config::resource_database { 'icingaweb_db':
  89. resource_db => "${::icingaweb2::web_db}",
  90. resource_host => "${::icingaweb2::web_db_host}",
  91. resource_port => "${::icingaweb2::web_db_port}",
  92. resource_dbname => "${::icingaweb2::web_db_name}",
  93. resource_username => "${::icingaweb2::web_db_user}",
  94. resource_password => "${::icingaweb2::web_db_pass}",
  95. }
  96. icingaweb2::config::resource_database { 'icinga_ido':
  97. resource_db => "${::icingaweb2::ido_db}",
  98. resource_host => "${::icingaweb2::ido_db_host}",
  99. resource_port => "${::icingaweb2::ido_db_port}",
  100. resource_dbname => "${::icingaweb2::ido_db_name}",
  101. resource_username => "${::icingaweb2::ido_db_user}",
  102. resource_password => "${::icingaweb2::ido_db_pass}",
  103. }
  104. # Configure roles.ini
  105. icingaweb2::config::roles { 'Admins':
  106. role_name => "${::icingaweb2::admin_users}",
  107. role_permissions => "${::icingaweb2::admin_permissions}",
  108. }
  109. if $::icingaweb2::manage_apache_vhost {
  110. ::apache::custom_config { 'icingaweb2':
  111. content => template("${::icingaweb2::template_apache}"),
  112. }
  113. }
  114. }