init.pp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. # == Class icingaweb2
  2. #
  3. # $admin_permissions::
  4. # Default:
  5. #
  6. # $admin_users::
  7. # Default:
  8. #
  9. # $auth_backend::
  10. # Default:
  11. #
  12. # $auth_resource::
  13. # Default:
  14. #
  15. # $config_dir:: Location of the main configuration directory.
  16. # Default: operating system specific.
  17. #
  18. # $config_dir_mode:: Posix file mode for configuration directories.
  19. # Default: 0755.
  20. #
  21. # $config_dir_recurse:: Apply the same posix permissions as $config_dir to any
  22. # directory contained in $config_dir.
  23. # Default: false.
  24. #
  25. # $config_file_mode:: Posix file mode for configuration files.
  26. # Default: 0644.
  27. #
  28. # $config_group:: Posix group for configuration files.
  29. # Default: operating system specific.
  30. #
  31. # $config_user:: Posix user for configuration files.
  32. # Default: operating system specific.
  33. #
  34. # $git_repo:: Source repository containing upstream IcingaWeb2.
  35. # Default: 'https://git.icinga.org/icingaWeb2.git'
  36. #
  37. # $git_revision:: Allows git revisions, tags, hashes, ... to be
  38. # specified.
  39. # Default: undef.
  40. #
  41. # $ido_db::
  42. # Default:
  43. #
  44. # $ido_db_host::
  45. # Default:
  46. #
  47. # $ido_db_name::
  48. # Default:
  49. #
  50. # $ido_db_pass::
  51. # Default:
  52. #
  53. # $ido_db_port::
  54. # Default:
  55. #
  56. # $ido_db_user::
  57. # Default:
  58. #
  59. # $ido_type::
  60. # Default:
  61. #
  62. # $install_method:: Defines how to install install IcingaWeb2.
  63. # Options: git, package
  64. # Default: git.
  65. #
  66. # $log_application::
  67. # Default:
  68. #
  69. # $log_level::
  70. # Default:
  71. #
  72. # $log_method::
  73. # Default:
  74. #
  75. # $log_resource::
  76. # Default:
  77. #
  78. # $log_store::
  79. # Default:
  80. #
  81. # $manage_apache_vhost:: Define wether or not this module should manage
  82. # the virtualhost using Puppetlabs' apache module.
  83. # Default: false.
  84. #
  85. # $manage_repo:: Add a custom package repository.
  86. # Default: false.
  87. #
  88. # $pkg_deps:: Any dependencies that need to be resolved before
  89. # installing the main package.
  90. # Default: operating system specific.
  91. #
  92. # $pkg_ensure:: Ensure state for packages.
  93. # Default: present.
  94. #
  95. # $pkg_list:: An array containing the main package and possibly
  96. # a number of dependencies.
  97. # Default: operating system specific.
  98. #
  99. # $pkg_repo_version::
  100. # Options: release, snapshot.
  101. # Default: release.
  102. #
  103. # $pkg_repo_release_key::
  104. # Default: operating system specific.
  105. #
  106. # $pkg_repo_release_metadata_expire::
  107. # Default: operating system specific.
  108. #
  109. # $pkg_repo_release_url::
  110. # Default: operating system specific.
  111. #
  112. # $pkg_repo_snapshot_key::
  113. # Default: operating system specific.
  114. #
  115. # $pkg_repo_snapshot_metadata_expire::
  116. # Default: operating system specific.
  117. #
  118. # $pkg_repo_snapshot_url::
  119. # Default: operating system specific.
  120. #
  121. # $template_auth::
  122. # Default: icingaweb2/authentication.ini.erb
  123. #
  124. # $template_config::
  125. # Default: icingaweb2/config.ini.erb
  126. #
  127. # $template_resources::
  128. # Default: icingaweb2/resources.ini.erb
  129. #
  130. # $template_roles::
  131. # Default: icingaweb2/roles.ini.erb
  132. #
  133. # $template_apache::
  134. # Default: icingaweb2/apache2.ini.erb
  135. #
  136. # $web_db::
  137. # Default:
  138. #
  139. # $web_db_host::
  140. # Default:
  141. #
  142. # $web_db_name::
  143. # Default:
  144. #
  145. # $web_db_pass::
  146. # Default:
  147. #
  148. # $web_db_port::
  149. # Default:
  150. #
  151. # $web_db_prefix::
  152. # Default:
  153. #
  154. # $web_db_user::
  155. # Default:
  156. #
  157. # $web_root:: Default location for when using using git.
  158. # Default: operating system specific.
  159. #
  160. # $web_type::
  161. # Default:
  162. #
  163. class icingaweb2 (
  164. $admin_permissions = $::icingaweb2::params::admin_permissions,
  165. $admin_users = $::icingaweb2::params::admin_users,
  166. $auth_backend = $::icingaweb2::params::auth_backend,
  167. $auth_resource = $::icingaweb2::params::auth_resource,
  168. $config_dir = $::icingaweb2::params::config_dir,
  169. $config_dir_mode = $::icingaweb2::params::config_dir_mode,
  170. $config_dir_recurse = $::icingaweb2::params::config_dir_recurse,
  171. $config_file_mode = $::icingaweb2::params::config_file_mode,
  172. $config_group = $::icingaweb2::params::config_group,
  173. $config_user = $::icingaweb2::params::config_user,
  174. $git_repo = $::icingaweb2::params::git_repo,
  175. $git_revision = $::icingaweb2::params::git_revision,
  176. $ido_db = $::icingaweb2::params::ido_db,
  177. $ido_db_host = $::icingaweb2::params::ido_db_host,
  178. $ido_db_name = $::icingaweb2::params::ido_db_name,
  179. $ido_db_pass = $::icingaweb2::params::ido_db_pass,
  180. $ido_db_port = $::icingaweb2::params::ido_db_port,
  181. $ido_db_user = $::icingaweb2::params::ido_db_user,
  182. $ido_type = $::icingaweb2::params::ido_type,
  183. $install_method = $::icingaweb2::params::install_method,
  184. $log_application = $::icingaweb2::params::log_application,
  185. $log_level = $::icingaweb2::params::log_level,
  186. $log_method = $::icingaweb2::params::log_method,
  187. $log_resource = $::icingaweb2::params::log_resource,
  188. $log_store = $::icingaweb2::params::log_store,
  189. $manage_apache_vhost = $::icingaweb2::params::manage_apache_vhost,
  190. $manage_repo = $::icingaweb2::params::manage_repo,
  191. $pkg_deps = $::icingaweb2::params::pkg_deps,
  192. $pkg_ensure = $::icingaweb2::params::pkg_ensure,
  193. $pkg_list = $::icingaweb2::params::pkg_list,
  194. $pkg_repo_release_key = $::icingaweb2::params::pkg_repo_release_key,
  195. $pkg_repo_release_metadata_expire = $::icingaweb2::params::pkg_repo_release_metadata_expire,
  196. $pkg_repo_release_url = $::icingaweb2::params::pkg_repo_release_url,
  197. $pkg_repo_snapshot_key = $::icingaweb2::params::pkg_repo_snapshot_key,
  198. $pkg_repo_snapshot_metadata_expire = $::icingaweb2::params::pkg_repo_snapshot_metadata_expire,
  199. $pkg_repo_snapshot_url = $::icingaweb2::params::pkg_repo_snapshot_url,
  200. $pkg_repo_version = $::icingaweb2::params::pkg_repo_version,
  201. $template_auth = $::icingaweb2::params::template_auth,
  202. $template_config = $::icingaweb2::params::template_config,
  203. $template_resources = $::icingaweb2::params::template_resources,
  204. $template_roles = $::icingaweb2::params::template_roles,
  205. $template_apache = $::icingaweb2::params::template_apache,
  206. $web_db = $::icingaweb2::params::web_db,
  207. $web_db_host = $::icingaweb2::params::web_db_host,
  208. $web_db_name = $::icingaweb2::params::web_db_name,
  209. $web_db_pass = $::icingaweb2::params::web_db_pass,
  210. $web_db_port = $::icingaweb2::params::web_db_port,
  211. $web_db_prefix = $::icingaweb2::params::web_db_prefix,
  212. $web_db_user = $::icingaweb2::params::web_db_user,
  213. $web_root = $::icingaweb2::params::web_root,
  214. $web_type = $::icingaweb2::params::web_type,
  215. ) inherits ::icingaweb2::params {
  216. class { '::icingaweb2::preinstall': } ->
  217. class { '::icingaweb2::install': } ->
  218. class { '::icingaweb2::config': } ->
  219. Class['::icingaweb2']
  220. validate_absolute_path($config_dir)
  221. validate_absolute_path($web_root)
  222. validate_array($pkg_deps)
  223. validate_array($pkg_list)
  224. validate_bool($config_dir_recurse)
  225. validate_bool($manage_repo)
  226. validate_slength($config_dir_mode, 4)
  227. validate_slength($config_file_mode, 4)
  228. validate_string($admin_permissions)
  229. validate_string($admin_users)
  230. validate_string($auth_backend)
  231. validate_string($auth_resource)
  232. validate_string($config_dir_mode)
  233. validate_string($config_file_mode)
  234. validate_string($config_group)
  235. validate_string($config_user)
  236. validate_string($log_application)
  237. validate_string($log_level)
  238. validate_string($log_method)
  239. validate_string($log_resource)
  240. validate_string($log_store)
  241. validate_string($pkg_ensure)
  242. validate_string($pkg_repo_release_key)
  243. validate_string($pkg_repo_release_url)
  244. validate_string($pkg_repo_snapshot_key)
  245. validate_string($pkg_repo_snapshot_url)
  246. validate_string($template_auth)
  247. validate_string($template_config)
  248. validate_string($template_resources)
  249. validate_string($template_roles)
  250. if $::icingaweb2::manage_apache_vhost {
  251. validate_string($template_apache)
  252. }
  253. if $pkg_repo_release_metadata_expire {
  254. validate_string($pkg_repo_release_metadata_expire)
  255. }
  256. if $pkg_repo_snapshot_metadata_expire {
  257. validate_string($pkg_repo_snapshot_metadata_expire)
  258. }
  259. validate_re($install_method,
  260. [
  261. 'git',
  262. 'package',
  263. ]
  264. )
  265. validate_re($pkg_ensure,
  266. [
  267. 'absent',
  268. 'latest',
  269. 'present',
  270. 'purged',
  271. ]
  272. )
  273. validate_re($pkg_repo_version,
  274. [
  275. 'release',
  276. 'snapshot',
  277. ]
  278. )
  279. }