config.pp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # == Class icingaweb2::config
  2. #
  3. class icingaweb2::config (
  4. $config_dir = $::icingaweb2::config_dir,
  5. $config_dir_purge = $::icingaweb2::config_dir_purge,
  6. $web_root = $::icingaweb2::web_root,
  7. ) {
  8. if $::icingaweb2::manage_user {
  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. }
  21. File {
  22. require => Class['::icingaweb2::install'],
  23. owner => $::icingaweb2::config_user,
  24. group => $::icingaweb2::config_group,
  25. mode => $::icingaweb2::config_file_mode,
  26. }
  27. file {
  28. $::icingaweb2::config_dir:
  29. ensure => directory,
  30. mode => $::icingaweb2::config_dir_mode,
  31. purge => $::icingaweb2::config_dir_purge,
  32. recurse => $::icingaweb2::config_dir_recurse;
  33. "${::icingaweb2::config_dir}/enabledModules":
  34. ensure => directory,
  35. mode => $::icingaweb2::config_dir_mode;
  36. "${::icingaweb2::config_dir}/modules":
  37. ensure => directory,
  38. mode => $::icingaweb2::config_dir_mode;
  39. "${::icingaweb2::config_dir}/authentication.ini":
  40. ensure => file;
  41. "${::icingaweb2::config_dir}/config.ini":
  42. ensure => file;
  43. "${::icingaweb2::config_dir}/resources.ini":
  44. ensure => file;
  45. "${::icingaweb2::config_dir}/roles.ini":
  46. ensure => file;
  47. $::icingaweb2::web_root:
  48. ensure => directory,
  49. mode => $::icingaweb2::config_dir_mode;
  50. "${::icingaweb2::web_root}/modules":
  51. ensure => directory,
  52. mode => $::icingaweb2::config_dir_mode;
  53. }
  54. # Configure authentication.ini settings
  55. case $::icingaweb2::auth_backend {
  56. 'db': {
  57. icingaweb2::config::authentication_database { 'Local Database Authentication':
  58. auth_section => 'icingaweb2',
  59. auth_resource => $::icingaweb2::auth_resource,
  60. }
  61. }
  62. 'external': {
  63. icingaweb2::config::authentication_external { 'External Authentication':
  64. auth_section => 'icingaweb2',
  65. }
  66. }
  67. 'ldap': {
  68. icingaweb2::config::authentication_ldap { 'LDAP Authentication':
  69. auth_section => 'icingaweb2',
  70. auth_resource => 'ldap',
  71. user_class => $::icingaweb2::auth_ldap_user_class,
  72. user_name_attribute => $::icingaweb2::auth_ldap_user_name_attribute,
  73. filter => $::icingaweb2::auth_ldap_filter,
  74. base_dn => $::icingaweb2::auth_ldap_base_dn,
  75. }
  76. }
  77. default: {}
  78. }
  79. # Configure config.ini settings
  80. Ini_Setting {
  81. ensure => present,
  82. require => File["${::icingaweb2::config_dir}/config.ini"],
  83. path => "${::icingaweb2::config_dir}/config.ini",
  84. }
  85. # Logging Configuration
  86. ini_setting { 'icingaweb2 config logging method':
  87. section => 'logging',
  88. setting => 'log',
  89. value => "\"${::icingaweb2::log_method}\"",
  90. }
  91. ini_setting { 'icingaweb2 config logging level':
  92. section => 'logging',
  93. setting => 'level',
  94. value => "\"${::icingaweb2::log_level}\"",
  95. }
  96. ini_setting { 'icingaweb2 config logging application':
  97. section => 'logging',
  98. setting => 'application',
  99. value => "\"${::icingaweb2::log_application}\"",
  100. }
  101. # Preferences Configuration
  102. ini_setting { 'icingaweb2 config preferences store':
  103. section => 'preferences',
  104. setting => 'store',
  105. value => "\"${::icingaweb2::log_store}\"",
  106. }
  107. ini_setting { 'icingaweb2 config preferences resource':
  108. section => 'preferences',
  109. setting => 'resource',
  110. value => "\"${::icingaweb2::log_resource}\"",
  111. }
  112. # Configure resources.ini
  113. icingaweb2::config::resource_database { 'icingaweb_db':
  114. resource_db => $::icingaweb2::web_db,
  115. resource_host => $::icingaweb2::web_db_host,
  116. resource_port => $::icingaweb2::web_db_port,
  117. resource_dbname => $::icingaweb2::web_db_name,
  118. resource_username => $::icingaweb2::web_db_user,
  119. resource_password => $::icingaweb2::web_db_pass,
  120. }
  121. icingaweb2::config::resource_database { 'icinga_ido':
  122. resource_db => $::icingaweb2::ido_db,
  123. resource_host => $::icingaweb2::ido_db_host,
  124. resource_port => $::icingaweb2::ido_db_port,
  125. resource_dbname => $::icingaweb2::ido_db_name,
  126. resource_username => $::icingaweb2::ido_db_user,
  127. resource_password => $::icingaweb2::ido_db_pass,
  128. }
  129. if $::icingaweb2::auth_backend == 'ldap' {
  130. icingaweb2::config::resource_ldap { 'ldap':
  131. resource_host => $::icingaweb2::ldap_host,
  132. resource_bind_dn => $::icingaweb2::ldap_bind_dn,
  133. resource_bind_pw => $::icingaweb2::ldap_bind_pw,
  134. resource_port => $::icingaweb2::ldap_port,
  135. resource_root_dn => $::icingaweb2::ldap_root_dn,
  136. resource_encryption => $::icingaweb2::ldap_encryption,
  137. }
  138. }
  139. # Configure roles.ini
  140. icingaweb2::config::roles { 'Admins':
  141. role_users => $::icingaweb2::admin_users,
  142. role_permissions => $::icingaweb2::admin_permissions,
  143. }
  144. if $::icingaweb2::manage_apache_vhost {
  145. ::apache::custom_config { 'icingaweb2':
  146. content => template($::icingaweb2::template_apache),
  147. }
  148. }
  149. }