init.pp 10 KB

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