params.pp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. # == Class: icinga2::params
  2. #
  3. # This class contains config options and settings for use elsewhere in the module.
  4. #
  5. # === Parameters
  6. #
  7. # See the inline comments.
  8. #
  9. class icinga2::params {
  10. ##############################
  11. # Icinga 2 common parameters
  12. ##############################
  13. #This section has parameters that are used by both the client and server subclasses
  14. ##################
  15. # Icinga 2 common package parameters
  16. case $::operatingsystem {
  17. #CentOS systems:
  18. 'CentOS': {
  19. #Pick the right package provider:
  20. $package_provider = 'yum'
  21. }
  22. #Ubuntu systems:
  23. 'Ubuntu': {
  24. #Pick the right package provider:
  25. $package_provider = 'apt'
  26. }
  27. #Debian systems:
  28. 'Debian': {
  29. #Pick the right package provider:
  30. $package_provider = 'apt'
  31. }
  32. #Fail if we're on any other OS:
  33. default: { fail("${::operatingsystem} is not supported!") }
  34. }
  35. ##############################
  36. # Icinga 2 server parameters
  37. ##############################
  38. #Whether to manage the package repositories
  39. $manage_repos = true
  40. $use_debmon_repo = false
  41. $server_db_type = 'pgsql'
  42. $install_mail_utils_package = false
  43. #Database paramters
  44. $db_name = 'icinga2_data'
  45. $db_user = 'icinga2'
  46. $db_password = 'password'
  47. $db_host = 'localhost'
  48. $db_port = '5432'
  49. #Whether to install the plugin packages when the icinga2::server class is applied:
  50. $server_install_nagios_plugins = true
  51. #What Icinga 2 features should be enabled when icinga2::server::features class is applied:
  52. $server_enabled_features = ['checker','notification']
  53. $server_disabled_features = []
  54. ##############################
  55. # Icinga 2 server package parameters
  56. #Pick the right package parameters based on the OS:
  57. case $::operatingsystem {
  58. #CentOS systems:
  59. 'CentOS': {
  60. case $::operatingsystemmajrelease {
  61. '5': {
  62. #Icinga 2 server package
  63. $icinga2_server_package = 'icinga2'
  64. $icinga2_server_plugin_packages = ['nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  65. $icinga2_server_mail_package = 'mailx'
  66. }
  67. '6': {
  68. #Icinga 2 server package
  69. $icinga2_server_package = 'icinga2'
  70. $icinga2_server_plugin_packages = ['nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  71. $icinga2_server_mail_package = 'mailx'
  72. }
  73. '7': {
  74. #Icinga 2 server package
  75. $icinga2_server_package = 'icinga2'
  76. $icinga2_server_plugin_packages = ['nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  77. $icinga2_server_mail_package = 'mailx'
  78. }
  79. #Fail if we're on any other CentOS release:
  80. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
  81. }
  82. }
  83. #Ubuntu systems:
  84. 'Ubuntu': {
  85. case $::operatingsystemrelease {
  86. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  87. '12.04': {
  88. $icinga2_server_package = 'icinga2'
  89. $icinga2_server_plugin_packages = ['nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-nrpe-plugin']
  90. $icinga2_server_mail_package = 'mailutils'
  91. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  92. $server_plugin_package_install_options = '--no-install-recommends'
  93. }
  94. #...but 14.04 does:
  95. '14.04': {
  96. $icinga2_server_package = 'icinga2'
  97. $icinga2_server_plugin_packages = [ 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-common', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  98. $icinga2_server_mail_package = 'mailutils'
  99. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  100. $server_plugin_package_install_options = '--no-install-recommends'
  101. }
  102. #Fail if we're on any other Ubuntu release:
  103. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  104. }
  105. }
  106. #Debian systems:
  107. 'Debian': {
  108. case $::operatingsystemmajrelease {
  109. #Only tested on Debian7
  110. '7': {
  111. $icinga2_server_package = 'icinga2'
  112. $icinga2_server_plugin_packages = ['nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  113. $icinga2_server_mail_package = 'mailutils'
  114. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  115. $server_plugin_package_install_options = '--no-install-recommends'
  116. }
  117. #Fail if we're on any other Debian release:
  118. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  119. }
  120. }
  121. #Fail if we're on any other OS:
  122. default: { fail("${::operatingsystem} is not supported!") }
  123. }
  124. ##############################
  125. # Icinga 2 server config parameters
  126. case $::operatingsystem {
  127. #CentOS systems:
  128. 'CentOS': {
  129. #Settings for /etc/icinga2/:
  130. $etc_icinga2_owner = 'icinga'
  131. $etc_icinga2_group = 'icinga'
  132. $etc_icinga2_mode = '0750'
  133. #Settings for /etc/icinga2/icinga2.conf:
  134. $etc_icinga2_icinga2_conf_owner = 'icinga'
  135. $etc_icinga2_icinga2_conf_group = 'icinga'
  136. $etc_icinga2_icinga2_conf_mode = '0640'
  137. #Settings for /etc/icinga2/conf.d/
  138. $etc_icinga2_confd_owner = 'icinga'
  139. $etc_icinga2_confd_group = 'icinga'
  140. $etc_icinga2_confd_mode = '0750'
  141. #Settings for /etc/icinga2/features-available/:
  142. $etc_icinga2_features_available_owner = 'icinga'
  143. $etc_icinga2_features_available_group = 'icinga'
  144. $etc_icinga2_features_available_mode = '0750'
  145. #Settings for /etc/icinga2/features-enabled/:
  146. $etc_icinga2_features_enabled_owner = 'icinga'
  147. $etc_icinga2_features_enabled_group = 'icinga'
  148. $etc_icinga2_features_enabled_mode = '0750'
  149. #Settings for /etc/icinga2/pki/:
  150. $etc_icinga2_pki_owner = 'icinga'
  151. $etc_icinga2_pki_group = 'icinga'
  152. $etc_icinga2_pki_mode = '0750'
  153. #Settings for /etc/icinga2/scripts/:
  154. $etc_icinga2_scripts_owner = 'icinga'
  155. $etc_icinga2_scripts_group = 'icinga'
  156. $etc_icinga2_scripts_mode = '0750'
  157. #Settings for /etc/icinga2/zones.d/:
  158. $etc_icinga2_zonesd_owner = 'icinga'
  159. $etc_icinga2_zonesd_group = 'icinga'
  160. $etc_icinga2_zonesd_mode = '0750'
  161. #Settings for /etc/icinga2/objects/:
  162. $etc_icinga2_obejcts_owner = 'icinga'
  163. $etc_icinga2_obejcts_group = 'icinga'
  164. $etc_icinga2_obejcts_mode = '0750'
  165. #Settings for subdirectories of /etc/icinga2/objects/:
  166. $etc_icinga2_obejcts_sub_dir_owner = 'icinga'
  167. $etc_icinga2_obejcts_sub_dir_group = 'icinga'
  168. $etc_icinga2_obejcts_sub_dir_mode = '0750'
  169. }
  170. #Ubuntu and Debian systems:
  171. /(Ubuntu|Debian)/: {
  172. #Settings for /etc/icinga2/:
  173. $etc_icinga2_owner = 'root'
  174. $etc_icinga2_group = 'root'
  175. $etc_icinga2_mode = '0755'
  176. #Settings for /etc/icinga2/icinga2.conf:
  177. $etc_icinga2_icinga2_conf_owner = 'root'
  178. $etc_icinga2_icinga2_conf_group = 'root'
  179. $etc_icinga2_icinga2_conf_mode = '0644'
  180. #Settings for /etc/icinga2/conf.d/
  181. $etc_icinga2_confd_owner = 'root'
  182. $etc_icinga2_confd_group = 'root'
  183. $etc_icinga2_confd_mode = '0755'
  184. #Settings for /etc/icinga2/features-available/:
  185. $etc_icinga2_features_available_owner = 'root'
  186. $etc_icinga2_features_available_group = 'root'
  187. $etc_icinga2_features_available_mode = '0755'
  188. #Settings for /etc/icinga2/features-enabled/:
  189. $etc_icinga2_features_enabled_owner = 'root'
  190. $etc_icinga2_features_enabled_group = 'root'
  191. $etc_icinga2_features_enabled_mode = '0755'
  192. #Settings for /etc/icinga2/pki/:
  193. $etc_icinga2_pki_owner = 'root'
  194. $etc_icinga2_pki_group = 'root'
  195. $etc_icinga2_pki_mode = '0755'
  196. #Settings for /etc/icinga2/scripts/:
  197. $etc_icinga2_scripts_owner = 'root'
  198. $etc_icinga2_scripts_group = 'root'
  199. $etc_icinga2_scripts_mode = '0755'
  200. #Settings for /etc/icinga2/zones.d/:
  201. $etc_icinga2_zonesd_owner = 'root'
  202. $etc_icinga2_zonesd_group = 'root'
  203. $etc_icinga2_zonesd_mode = '0755'
  204. #Settings for /etc/icinga2/objects/:
  205. $etc_icinga2_obejcts_owner = 'root'
  206. $etc_icinga2_obejcts_group = 'root'
  207. $etc_icinga2_obejcts_mode = '0755'
  208. #Settings for subdirectories of /etc/icinga2/objects/:
  209. $etc_icinga2_obejcts_sub_dir_owner = 'root'
  210. $etc_icinga2_obejcts_sub_dir_group = 'root'
  211. $etc_icinga2_obejcts_sub_dir_mode = '0755'
  212. }
  213. #Fail if we're on any other OS:
  214. default: { fail("${::operatingsystem} is not supported!") }
  215. }
  216. #Whether to purge object files or directories in /etc/icinga2/objects that aren't managed by Puppet
  217. $purge_unmanaged_object_files = false
  218. ##################
  219. # Icinga 2 server service settings
  220. case $::operatingsystem {
  221. #Icinga 2 server daemon names for Red Had/CentOS systems:
  222. 'CentOS': {
  223. case $::operatingsystemmajrelease {
  224. '5': {
  225. $icinga2_server_service_name = 'icinga2'
  226. }
  227. '6': {
  228. $icinga2_server_service_name = 'icinga2'
  229. }
  230. '7': {
  231. $icinga2_server_service_name = 'icinga2'
  232. }
  233. #Fail if we're on any other CentOS release:
  234. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
  235. }
  236. }
  237. #Icinga 2 server daemon names for Ubuntu systems:
  238. 'Ubuntu': {
  239. case $::operatingsystemmajrelease {
  240. '12.04': {
  241. $icinga2_server_service_name = 'icinga2'
  242. }
  243. '14.04': {
  244. $icinga2_server_service_name = 'icinga2'
  245. }
  246. #Fail if we're on any other Ubuntu release:
  247. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  248. }
  249. }
  250. #Icinga 2 server daemon names for Debian systems:
  251. 'Debian': {
  252. case $::operatingsystemmajrelease {
  253. '7': {
  254. $icinga2_server_service_name = 'icinga2'
  255. }
  256. #Fail if we're on any other Debian release:
  257. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  258. }
  259. }
  260. #Fail if we're on any other OS:
  261. default: { fail("${::operatingsystem} is not supported!") }
  262. }
  263. ##############################
  264. # Icinga 2 client parameters
  265. ##############################
  266. ##################
  267. # Icinga 2 client settings
  268. $nrpe_listen_port = '5666'
  269. $nrpe_log_facility = 'daemon'
  270. $nrpe_debug_level = '0'
  271. #in seconds:
  272. $nrpe_command_timeout = '60'
  273. #in seconds:
  274. $nrpe_connection_timeout = '300'
  275. #Note: because we use .join in the nrpe.cfg.erb template, this value *must* be an array
  276. $nrpe_allowed_hosts = ['127.0.0.1',]
  277. #Determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed
  278. # *** ENABLING THIS OPTION IS A SECURITY RISK! ***
  279. # Defaults to NOT allow command arguments
  280. $allow_command_argument_processing = '0'
  281. # Whether or not to purge nrpe config files NOT managed by Puppet.
  282. $nrpe_purge_unmanaged = false
  283. case $::operatingsystem {
  284. #File and template variable names for Red Had/CentOS systems:
  285. 'CentOS': {
  286. $nrpe_config_basedir = '/etc/nagios'
  287. $nrpe_plugin_libdir = '/usr/lib64/nagios/plugins'
  288. $checkplugin_libdir = '/usr/lib64/nagios/plugins'
  289. $nrpe_pid_file_path = '/var/run/nrpe/nrpe.pid'
  290. $nrpe_user = 'nrpe'
  291. $nrpe_group = 'nrpe'
  292. }
  293. #File and template variable names for Ubuntu systems:
  294. 'Ubuntu': {
  295. $nrpe_config_basedir = '/etc/nagios'
  296. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  297. $checkplugin_libdir = '/usr/lib/nagios/plugins'
  298. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  299. $nrpe_user = 'nagios'
  300. $nrpe_group = 'nagios'
  301. }
  302. #File and template variable names for Ubuntu systems:
  303. 'Debian': {
  304. $nrpe_config_basedir = '/etc/nagios'
  305. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  306. $checkplugin_libdir = '/usr/lib/nagios/plugins'
  307. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  308. $nrpe_user = 'nagios'
  309. $nrpe_group = 'nagios'
  310. }
  311. #Fail if we're on any other OS:
  312. default: { fail("${::operatingsystem} is not supported!") }
  313. }
  314. ##################
  315. # Icinga 2 client package parameters
  316. case $::operatingsystem {
  317. #CentOS systems:
  318. 'CentOS': {
  319. case $::operatingsystemmajrelease {
  320. '5': {
  321. #Pick the right list of client packages:
  322. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  323. }
  324. '6': {
  325. #Pick the right list of client packages:
  326. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  327. }
  328. '7': {
  329. #Pick the right list of client packages:
  330. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  331. }
  332. #Fail if we're on any other CentOS release:
  333. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release version!") }
  334. }
  335. }
  336. #Ubuntu systems:
  337. 'Ubuntu': {
  338. case $::operatingsystemrelease {
  339. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  340. '12.04': {
  341. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-nrpe-plugin']
  342. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  343. $client_plugin_package_install_options = '--no-install-recommends'
  344. }
  345. #...but 14.04 does:
  346. '14.04': {
  347. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-common', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  348. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  349. $client_plugin_package_install_options = '--no-install-recommends'
  350. }
  351. #Fail if we're on any other Ubuntu release:
  352. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  353. }
  354. }
  355. #Debian systems:
  356. 'Debian': {
  357. case $::operatingsystemmajrelease {
  358. '7': {
  359. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  360. #Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
  361. $client_plugin_package_install_options = '--no-install-recommends'
  362. }
  363. #Fail if we're on any other Debian release:
  364. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  365. }
  366. }
  367. #Fail if we're on any other OS:
  368. default: { fail("${::operatingsystem} is not supported!") }
  369. }
  370. ##################
  371. # Icinga 2 client service parameters
  372. case $::operatingsystem {
  373. #Daemon names for Red Had/CentOS systems:
  374. 'CentOS': {
  375. $nrpe_daemon_name = 'nrpe'
  376. }
  377. #Daemon names for Ubuntu systems:
  378. 'Ubuntu': {
  379. $nrpe_daemon_name = 'nagios-nrpe-server'
  380. }
  381. #Daemon names for Debian systems:
  382. 'Debian': {
  383. $nrpe_daemon_name = 'nagios-nrpe-server'
  384. }
  385. #Fail if we're on any other OS:
  386. default: { fail("${::operatingsystem} is not supported!") }
  387. }
  388. }