init.pp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. # == Class icingaweb2
  2. #
  3. # $admin_permissions::
  4. # Default:
  5. #
  6. # $admin_users::
  7. # Default:
  8. #
  9. # $auth_backend::
  10. # Default:
  11. #
  12. # $auth_ldap_base_dn:: LDAP base dn.
  13. # Default: undef
  14. #
  15. # $auth_ldap_filter:: LDAP authentication filter.
  16. # Default: undef
  17. #
  18. # $auth_ldap_user_class:: LDAP authentication user class.
  19. # Default: inetOrgPerson
  20. #
  21. # $auth_ldap_user_name_attribute:: LDAP authentication user name attribute.
  22. # Default: uid
  23. #
  24. # $auth_resource::
  25. # Default:
  26. #
  27. # $config_dir:: Location of the main configuration directory.
  28. # Default: operating system specific.
  29. #
  30. # $config_dir_mode:: Posix file mode for configuration directories.
  31. # Default: 0755.
  32. #
  33. # $config_dir_purge:: The $config_dir is purge at each puppet run.
  34. # Unmanaged puppet file will be lost
  35. # Default: false.
  36. #
  37. # $config_dir_recurse:: Apply the same posix permissions as $config_dir to any
  38. # directory contained in $config_dir.
  39. # Default: false.
  40. #
  41. # $config_file_mode:: Posix file mode for configuration files.
  42. # Default: 0644.
  43. #
  44. # $config_group:: Posix group for configuration files.
  45. # Default: operating system specific.
  46. #
  47. # $config_user:: Posix user for configuration files.
  48. # Default: operating system specific.
  49. #
  50. # $git_repo:: Source repository containing upstream IcingaWeb2.
  51. # Default: 'https://git.icinga.org/icingaWeb2.git'
  52. #
  53. # $git_revision:: Allows git revisions, tags, hashes, ... to be
  54. # specified.
  55. # Default: undef.
  56. #
  57. # $ido_db::
  58. # Default:
  59. #
  60. # $ido_db_host::
  61. # Default:
  62. #
  63. # $ido_db_name::
  64. # Default:
  65. #
  66. # $ido_db_pass::
  67. # Default:
  68. #
  69. # $ido_db_port::
  70. # Default:
  71. #
  72. # $ido_db_user::
  73. # Default:
  74. #
  75. # $ido_type::
  76. # Default:
  77. #
  78. # $install_method:: Defines how to install install IcingaWeb2.
  79. # Options: git, package
  80. # Default: git.
  81. #
  82. # $ldap_bind_dn:: LDAP bind dn
  83. # Default: undef
  84. #
  85. # $ldap_bind_pw:: LDAP bind pw
  86. # Default: undef
  87. #
  88. # $ldap_encryption:: LDAP encryption method
  89. # Allowed values are "starttls" and "ldaps".
  90. # Default: undef
  91. #
  92. # $ldap_host:: LDAP hostname
  93. # Default: undef
  94. #
  95. # $ldap_port:: LDAP bind port
  96. # Default: 389
  97. #
  98. # $ldap_root_dn:: LDAP root dn
  99. # Default: undef
  100. #
  101. # $log_application::
  102. # Default:
  103. #
  104. # $log_level::
  105. # Default:
  106. #
  107. # $log_method::
  108. # Default:
  109. #
  110. # $log_resource::
  111. # Default:
  112. #
  113. # $log_store::
  114. # Default:
  115. #
  116. # $manage_apache_vhost:: Define wether or not this module should manage
  117. # the virtualhost using Puppetlabs' apache module.
  118. # Default: false.
  119. #
  120. # $manage_repo:: Add a custom package repository.
  121. # Default: false.
  122. #
  123. # $manage_user:: Defines if user and group should be managed
  124. # by this module. Set to false if you don't want
  125. # user and group to be managed by this module.
  126. # Default: true.
  127. #
  128. # $pkg_deps:: Any dependencies that need to be resolved before
  129. # installing the main package.
  130. # Default: operating system specific.
  131. #
  132. # $pkg_ensure:: Ensure state for packages.
  133. # Default: present.
  134. #
  135. # $pkg_list:: An array containing the main package and possibly
  136. # a number of dependencies.
  137. # Default: operating system specific.
  138. #
  139. # $pkg_repo_version::
  140. # Options: release, snapshot.
  141. # Default: release.
  142. #
  143. # $pkg_repo_release_key::
  144. # Default: operating system specific.
  145. #
  146. # $pkg_repo_release_metadata_expire::
  147. # Default: operating system specific.
  148. #
  149. # $pkg_repo_release_url::
  150. # Default: operating system specific.
  151. #
  152. # $pkg_repo_snapshot_key::
  153. # Default: operating system specific.
  154. #
  155. # $pkg_repo_snapshot_metadata_expire::
  156. # Default: operating system specific.
  157. #
  158. # $pkg_repo_snapshot_url::
  159. # Default: operating system specific.
  160. #
  161. # $template_auth::
  162. # Default: icingaweb2/authentication.ini.erb
  163. #
  164. # $template_config::
  165. # Default: icingaweb2/config.ini.erb
  166. #
  167. # $template_resources::
  168. # Default: icingaweb2/resources.ini.erb
  169. #
  170. # $template_roles::
  171. # Default: icingaweb2/roles.ini.erb
  172. #
  173. # $template_apache::
  174. # Default: icingaweb2/apache2.ini.erb
  175. #
  176. # $web_db::
  177. # Default:
  178. #
  179. # $web_db_host::
  180. # Default:
  181. #
  182. # $web_db_name::
  183. # Default:
  184. #
  185. # $web_db_pass::
  186. # Default:
  187. #
  188. # $web_db_port::
  189. # Default:
  190. #
  191. # $web_db_prefix::
  192. # Default:
  193. #
  194. # $web_db_user::
  195. # Default:
  196. #
  197. # $web_root:: Default location for when using using git.
  198. # Default: operating system specific.
  199. #
  200. # $web_type::
  201. # Default:
  202. #
  203. # $initialize:: Whether or not to initialize a db scheme and a user
  204. # Default : false
  205. class icingaweb2 (
  206. $admin_permissions = $::icingaweb2::params::admin_permissions,
  207. $admin_users = $::icingaweb2::params::admin_users,
  208. $auth_backend = $::icingaweb2::params::auth_backend,
  209. $auth_ldap_base_dn = $::icingaweb2::params::auth_base_dn,
  210. $auth_ldap_filter = $::icingaweb2::params::auth_ldap_filter,
  211. $auth_ldap_user_class = $::icingaweb2::params::auth_ldap_user_class,
  212. $auth_ldap_user_name_attribute = $::icingaweb2::params::auth_ldap_user_name_attribute,
  213. $auth_resource = $::icingaweb2::params::auth_resource,
  214. $config_dir = $::icingaweb2::params::config_dir,
  215. $config_dir_mode = $::icingaweb2::params::config_dir_mode,
  216. $config_dir_purge = $::icingaweb2::params::config_dir_purge,
  217. $config_dir_recurse = $::icingaweb2::params::config_dir_recurse,
  218. $config_file_mode = $::icingaweb2::params::config_file_mode,
  219. $config_group = $::icingaweb2::params::config_group,
  220. $config_user = $::icingaweb2::params::config_user,
  221. $git_repo = $::icingaweb2::params::git_repo,
  222. $git_revision = $::icingaweb2::params::git_revision,
  223. $ido_db = $::icingaweb2::params::ido_db,
  224. $ido_db_host = $::icingaweb2::params::ido_db_host,
  225. $ido_db_name = $::icingaweb2::params::ido_db_name,
  226. $ido_db_pass = $::icingaweb2::params::ido_db_pass,
  227. $ido_db_port = $::icingaweb2::params::ido_db_port,
  228. $ido_db_user = $::icingaweb2::params::ido_db_user,
  229. $ido_type = $::icingaweb2::params::ido_type,
  230. $install_method = $::icingaweb2::params::install_method,
  231. $ldap_bind_dn = $::icingaweb2::params::ldap_bind_dn,
  232. $ldap_bind_pw = $::icingaweb2::params::ldap_bind_pw,
  233. $ldap_encryption = $::icingaweb2::params::ldap_encryption,
  234. $ldap_host = $::icingaweb2::params::ldap_host,
  235. $ldap_port = $::icingaweb2::params::ldap_port,
  236. $ldap_root_dn = $::icingaweb2::params::ldap_root_dn,
  237. $log_application = $::icingaweb2::params::log_application,
  238. $log_level = $::icingaweb2::params::log_level,
  239. $log_method = $::icingaweb2::params::log_method,
  240. $log_resource = $::icingaweb2::params::log_resource,
  241. $log_store = $::icingaweb2::params::log_store,
  242. $manage_apache_vhost = $::icingaweb2::params::manage_apache_vhost,
  243. $manage_repo = $::icingaweb2::params::manage_repo,
  244. $manage_user = $::icingaweb2::params::manage_user,
  245. $pkg_deps = $::icingaweb2::params::pkg_deps,
  246. $pkg_ensure = $::icingaweb2::params::pkg_ensure,
  247. $pkg_list = $::icingaweb2::params::pkg_list,
  248. $pkg_repo_release_key = $::icingaweb2::params::pkg_repo_release_key,
  249. $pkg_repo_release_metadata_expire = $::icingaweb2::params::pkg_repo_release_metadata_expire,
  250. $pkg_repo_release_url = $::icingaweb2::params::pkg_repo_release_url,
  251. $pkg_repo_snapshot_key = $::icingaweb2::params::pkg_repo_snapshot_key,
  252. $pkg_repo_snapshot_metadata_expire = $::icingaweb2::params::pkg_repo_snapshot_metadata_expire,
  253. $pkg_repo_snapshot_url = $::icingaweb2::params::pkg_repo_snapshot_url,
  254. $pkg_repo_version = $::icingaweb2::params::pkg_repo_version,
  255. $template_auth = $::icingaweb2::params::template_auth,
  256. $template_config = $::icingaweb2::params::template_config,
  257. $template_resources = $::icingaweb2::params::template_resources,
  258. $template_roles = $::icingaweb2::params::template_roles,
  259. $template_apache = $::icingaweb2::params::template_apache,
  260. $web_db = $::icingaweb2::params::web_db,
  261. $web_db_host = $::icingaweb2::params::web_db_host,
  262. $web_db_name = $::icingaweb2::params::web_db_name,
  263. $web_db_pass = $::icingaweb2::params::web_db_pass,
  264. $web_db_port = $::icingaweb2::params::web_db_port,
  265. $web_db_prefix = $::icingaweb2::params::web_db_prefix,
  266. $web_db_user = $::icingaweb2::params::web_db_user,
  267. $web_root = $::icingaweb2::params::web_root,
  268. $web_type = $::icingaweb2::params::web_type,
  269. $initialize = $::icingaweb2::params::initialize,
  270. ) inherits ::icingaweb2::params {
  271. class { '::icingaweb2::preinstall': } ->
  272. class { '::icingaweb2::install': } ->
  273. class { '::icingaweb2::config': } ->
  274. class { '::icingaweb2::initialize': } ->
  275. Class['::icingaweb2']
  276. validate_absolute_path($config_dir)
  277. validate_absolute_path($web_root)
  278. validate_array($pkg_deps)
  279. validate_array($pkg_list)
  280. validate_bool($config_dir_recurse)
  281. validate_bool($manage_repo)
  282. validate_bool($manage_user)
  283. validate_bool($initialize)
  284. validate_slength($config_dir_mode, 4)
  285. validate_slength($config_file_mode, 4)
  286. validate_string($admin_permissions)
  287. validate_string($admin_users)
  288. validate_string($auth_backend)
  289. validate_string($auth_resource)
  290. validate_string($config_dir_mode)
  291. validate_string($config_file_mode)
  292. validate_string($config_group)
  293. validate_string($config_user)
  294. validate_string($log_application)
  295. validate_string($log_level)
  296. validate_string($log_method)
  297. validate_string($log_resource)
  298. validate_string($log_store)
  299. validate_string($pkg_ensure)
  300. validate_string($pkg_repo_release_key)
  301. validate_string($pkg_repo_release_url)
  302. validate_string($pkg_repo_snapshot_key)
  303. validate_string($pkg_repo_snapshot_url)
  304. validate_string($template_auth)
  305. validate_string($template_config)
  306. validate_string($template_resources)
  307. validate_string($template_roles)
  308. if $::icingaweb2::auth_backend == 'ldap' {
  309. validate_integer($ldap_port)
  310. validate_string($auth_ldap_base_dn)
  311. validate_string($auth_ldap_filter)
  312. validate_string($auth_ldap_user_class)
  313. validate_string($auth_ldap_user_name_attribute)
  314. validate_string($ldap_host)
  315. validate_string($ldap_bind_dn)
  316. validate_string($ldap_bind_pw)
  317. validate_string($ldap_root_dn)
  318. if $::icingaweb2::ldap_encryption {
  319. validate_re( $ldap_encryption, '^(ldaps|starttls)$', "\$ldap_encryption must be either 'ldaps' or 'starttls', got '${ldap_encryption}'")
  320. }
  321. }
  322. if $::icingaweb2::manage_apache_vhost {
  323. validate_string($template_apache)
  324. }
  325. if $pkg_repo_release_metadata_expire {
  326. validate_string($pkg_repo_release_metadata_expire)
  327. }
  328. if $pkg_repo_snapshot_metadata_expire {
  329. validate_string($pkg_repo_snapshot_metadata_expire)
  330. }
  331. validate_re($install_method,
  332. [
  333. 'git',
  334. 'package',
  335. ]
  336. )
  337. validate_re($pkg_ensure,
  338. [
  339. 'absent',
  340. 'latest',
  341. 'present',
  342. 'purged',
  343. ]
  344. )
  345. validate_re($pkg_repo_version,
  346. [
  347. 'release',
  348. 'snapshot',
  349. ]
  350. )
  351. }