init.pp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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. # $manage_user:: Defines if user and group should be managed
  93. # by this module. Set to false if you don't want
  94. # user and group to be managed by this module.
  95. # Default: true.
  96. #
  97. # $pkg_deps:: Any dependencies that need to be resolved before
  98. # installing the main package.
  99. # Default: operating system specific.
  100. #
  101. # $pkg_ensure:: Ensure state for packages.
  102. # Default: present.
  103. #
  104. # $pkg_list:: An array containing the main package and possibly
  105. # a number of dependencies.
  106. # Default: operating system specific.
  107. #
  108. # $pkg_repo_version::
  109. # Options: release, snapshot.
  110. # Default: release.
  111. #
  112. # $pkg_repo_release_key::
  113. # Default: operating system specific.
  114. #
  115. # $pkg_repo_release_metadata_expire::
  116. # Default: operating system specific.
  117. #
  118. # $pkg_repo_release_url::
  119. # Default: operating system specific.
  120. #
  121. # $pkg_repo_snapshot_key::
  122. # Default: operating system specific.
  123. #
  124. # $pkg_repo_snapshot_metadata_expire::
  125. # Default: operating system specific.
  126. #
  127. # $pkg_repo_snapshot_url::
  128. # Default: operating system specific.
  129. #
  130. # $template_auth::
  131. # Default: icingaweb2/authentication.ini.erb
  132. #
  133. # $template_config::
  134. # Default: icingaweb2/config.ini.erb
  135. #
  136. # $template_resources::
  137. # Default: icingaweb2/resources.ini.erb
  138. #
  139. # $template_roles::
  140. # Default: icingaweb2/roles.ini.erb
  141. #
  142. # $template_apache::
  143. # Default: icingaweb2/apache2.ini.erb
  144. #
  145. # $web_db::
  146. # Default:
  147. #
  148. # $web_db_host::
  149. # Default:
  150. #
  151. # $web_db_name::
  152. # Default:
  153. #
  154. # $web_db_pass::
  155. # Default:
  156. #
  157. # $web_db_port::
  158. # Default:
  159. #
  160. # $web_db_prefix::
  161. # Default:
  162. #
  163. # $web_db_user::
  164. # Default:
  165. #
  166. # $web_root:: Default location for when using using git.
  167. # Default: operating system specific.
  168. #
  169. # $web_type::
  170. # Default:
  171. #
  172. # $initialize:: Whether or not to initialize a db scheme and a user
  173. # Default : false
  174. class icingaweb2 (
  175. $admin_permissions = $::icingaweb2::params::admin_permissions,
  176. $admin_users = $::icingaweb2::params::admin_users,
  177. $auth_backend = $::icingaweb2::params::auth_backend,
  178. $auth_resource = $::icingaweb2::params::auth_resource,
  179. $config_dir = $::icingaweb2::params::config_dir,
  180. $config_dir_mode = $::icingaweb2::params::config_dir_mode,
  181. $config_dir_purge = $::icingaweb2::params::config_dir_purge,
  182. $config_dir_recurse = $::icingaweb2::params::config_dir_recurse,
  183. $config_file_mode = $::icingaweb2::params::config_file_mode,
  184. $config_group = $::icingaweb2::params::config_group,
  185. $config_user = $::icingaweb2::params::config_user,
  186. $git_repo = $::icingaweb2::params::git_repo,
  187. $git_revision = $::icingaweb2::params::git_revision,
  188. $ido_db = $::icingaweb2::params::ido_db,
  189. $ido_db_host = $::icingaweb2::params::ido_db_host,
  190. $ido_db_name = $::icingaweb2::params::ido_db_name,
  191. $ido_db_pass = $::icingaweb2::params::ido_db_pass,
  192. $ido_db_port = $::icingaweb2::params::ido_db_port,
  193. $ido_db_user = $::icingaweb2::params::ido_db_user,
  194. $ido_type = $::icingaweb2::params::ido_type,
  195. $install_method = $::icingaweb2::params::install_method,
  196. $log_application = $::icingaweb2::params::log_application,
  197. $log_level = $::icingaweb2::params::log_level,
  198. $log_method = $::icingaweb2::params::log_method,
  199. $log_resource = $::icingaweb2::params::log_resource,
  200. $log_store = $::icingaweb2::params::log_store,
  201. $manage_apache_vhost = $::icingaweb2::params::manage_apache_vhost,
  202. $manage_repo = $::icingaweb2::params::manage_repo,
  203. $manage_user = $::icingaweb2::params::manage_user,
  204. $pkg_deps = $::icingaweb2::params::pkg_deps,
  205. $pkg_ensure = $::icingaweb2::params::pkg_ensure,
  206. $pkg_list = $::icingaweb2::params::pkg_list,
  207. $pkg_repo_release_key = $::icingaweb2::params::pkg_repo_release_key,
  208. $pkg_repo_release_metadata_expire = $::icingaweb2::params::pkg_repo_release_metadata_expire,
  209. $pkg_repo_release_url = $::icingaweb2::params::pkg_repo_release_url,
  210. $pkg_repo_snapshot_key = $::icingaweb2::params::pkg_repo_snapshot_key,
  211. $pkg_repo_snapshot_metadata_expire = $::icingaweb2::params::pkg_repo_snapshot_metadata_expire,
  212. $pkg_repo_snapshot_url = $::icingaweb2::params::pkg_repo_snapshot_url,
  213. $pkg_repo_version = $::icingaweb2::params::pkg_repo_version,
  214. $template_auth = $::icingaweb2::params::template_auth,
  215. $template_config = $::icingaweb2::params::template_config,
  216. $template_resources = $::icingaweb2::params::template_resources,
  217. $template_roles = $::icingaweb2::params::template_roles,
  218. $template_apache = $::icingaweb2::params::template_apache,
  219. $web_db = $::icingaweb2::params::web_db,
  220. $web_db_host = $::icingaweb2::params::web_db_host,
  221. $web_db_name = $::icingaweb2::params::web_db_name,
  222. $web_db_pass = $::icingaweb2::params::web_db_pass,
  223. $web_db_port = $::icingaweb2::params::web_db_port,
  224. $web_db_prefix = $::icingaweb2::params::web_db_prefix,
  225. $web_db_user = $::icingaweb2::params::web_db_user,
  226. $web_root = $::icingaweb2::params::web_root,
  227. $web_type = $::icingaweb2::params::web_type,
  228. $initialize = $::icingaweb2::params::initialize,
  229. ) inherits ::icingaweb2::params {
  230. class { '::icingaweb2::preinstall': } ->
  231. class { '::icingaweb2::install': } ->
  232. class { '::icingaweb2::config': } ->
  233. class { '::icingaweb2::initialize': } ->
  234. Class['::icingaweb2']
  235. validate_absolute_path($config_dir)
  236. validate_absolute_path($web_root)
  237. validate_array($pkg_deps)
  238. validate_array($pkg_list)
  239. validate_bool($config_dir_recurse)
  240. validate_bool($manage_repo)
  241. validate_bool($manage_user)
  242. validate_bool($initialize)
  243. validate_slength($config_dir_mode, 4)
  244. validate_slength($config_file_mode, 4)
  245. validate_string($admin_permissions)
  246. validate_string($admin_users)
  247. validate_string($auth_backend)
  248. validate_string($auth_resource)
  249. validate_string($config_dir_mode)
  250. validate_string($config_file_mode)
  251. validate_string($config_group)
  252. validate_string($config_user)
  253. validate_string($log_application)
  254. validate_string($log_level)
  255. validate_string($log_method)
  256. validate_string($log_resource)
  257. validate_string($log_store)
  258. validate_string($pkg_ensure)
  259. validate_string($pkg_repo_release_key)
  260. validate_string($pkg_repo_release_url)
  261. validate_string($pkg_repo_snapshot_key)
  262. validate_string($pkg_repo_snapshot_url)
  263. validate_string($template_auth)
  264. validate_string($template_config)
  265. validate_string($template_resources)
  266. validate_string($template_roles)
  267. if $::icingaweb2::manage_apache_vhost {
  268. validate_string($template_apache)
  269. }
  270. if $pkg_repo_release_metadata_expire {
  271. validate_string($pkg_repo_release_metadata_expire)
  272. }
  273. if $pkg_repo_snapshot_metadata_expire {
  274. validate_string($pkg_repo_snapshot_metadata_expire)
  275. }
  276. validate_re($install_method,
  277. [
  278. 'git',
  279. 'package',
  280. ]
  281. )
  282. validate_re($pkg_ensure,
  283. [
  284. 'absent',
  285. 'latest',
  286. 'present',
  287. 'purged',
  288. ]
  289. )
  290. validate_re($pkg_repo_version,
  291. [
  292. 'release',
  293. 'snapshot',
  294. ]
  295. )
  296. }