params.pp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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. ##################
  217. # Icinga 2 server service settings
  218. case $::operatingsystem {
  219. #Icinga 2 server daemon names for Red Had/CentOS systems:
  220. 'CentOS': {
  221. case $::operatingsystemmajrelease {
  222. '5': {
  223. $icinga2_server_service_name = 'icinga2'
  224. }
  225. '6': {
  226. $icinga2_server_service_name = 'icinga2'
  227. }
  228. '7': {
  229. $icinga2_server_service_name = 'icinga2'
  230. }
  231. #Fail if we're on any other CentOS release:
  232. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
  233. }
  234. }
  235. #Icinga 2 server daemon names for Ubuntu systems:
  236. 'Ubuntu': {
  237. case $::operatingsystemmajrelease {
  238. '12.04': {
  239. $icinga2_server_service_name = 'icinga2'
  240. }
  241. '14.04': {
  242. $icinga2_server_service_name = 'icinga2'
  243. }
  244. #Fail if we're on any other Ubuntu release:
  245. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  246. }
  247. }
  248. #Icinga 2 server daemon names for Debian systems:
  249. 'Debian': {
  250. case $::operatingsystemmajrelease {
  251. '7': {
  252. $icinga2_server_service_name = 'icinga2'
  253. }
  254. #Fail if we're on any other Debian release:
  255. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  256. }
  257. }
  258. #Fail if we're on any other OS:
  259. default: { fail("${::operatingsystem} is not supported!") }
  260. }
  261. ##############################
  262. # Icinga 2 client parameters
  263. ##############################
  264. ##################
  265. # Icinga 2 client settings
  266. $nrpe_listen_port = '5666'
  267. $nrpe_log_facility = 'daemon'
  268. $nrpe_debug_level = '0'
  269. #in seconds:
  270. $nrpe_command_timeout = '60'
  271. #in seconds:
  272. $nrpe_connection_timeout = '300'
  273. #Note: because we use .join in the nrpe.cfg.erb template, this value *must* be an array
  274. $nrpe_allowed_hosts = ['127.0.0.1',]
  275. #Determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed
  276. # *** ENABLING THIS OPTION IS A SECURITY RISK! ***
  277. # Defaults to NOT allow command arguments
  278. $allow_command_argument_processing = '0'
  279. # Whether or not to purge nrpe config files NOT managed by Puppet.
  280. $nrpe_purge_unmanaged = false
  281. case $::operatingsystem {
  282. #File and template variable names for Red Had/CentOS systems:
  283. 'CentOS': {
  284. $nrpe_config_basedir = '/etc/nagios'
  285. $nrpe_plugin_libdir = '/usr/lib64/nagios/plugins'
  286. $checkplugin_libdir = '/usr/lib64/nagios/plugins'
  287. $nrpe_pid_file_path = '/var/run/nrpe/nrpe.pid'
  288. $nrpe_user = 'nrpe'
  289. $nrpe_group = 'nrpe'
  290. }
  291. #File and template variable names for Ubuntu systems:
  292. 'Ubuntu': {
  293. $nrpe_config_basedir = '/etc/nagios'
  294. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  295. $checkplugin_libdir = '/usr/lib/nagios/plugins'
  296. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  297. $nrpe_user = 'nagios'
  298. $nrpe_group = 'nagios'
  299. }
  300. #File and template variable names for Ubuntu systems:
  301. 'Debian': {
  302. $nrpe_config_basedir = '/etc/nagios'
  303. $nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
  304. $checkplugin_libdir = '/usr/lib/nagios/plugins'
  305. $nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
  306. $nrpe_user = 'nagios'
  307. $nrpe_group = 'nagios'
  308. }
  309. #Fail if we're on any other OS:
  310. default: { fail("${::operatingsystem} is not supported!") }
  311. }
  312. ##################
  313. # Icinga 2 client package parameters
  314. case $::operatingsystem {
  315. #CentOS systems:
  316. 'CentOS': {
  317. case $::operatingsystemmajrelease {
  318. '5': {
  319. #Pick the right list of client packages:
  320. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  321. }
  322. '6': {
  323. #Pick the right list of client packages:
  324. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  325. }
  326. '7': {
  327. #Pick the right list of client packages:
  328. $icinga2_client_packages = ['nrpe', 'nagios-plugins-nrpe', 'nagios-plugins-all', 'nagios-plugins-openmanage', 'nagios-plugins-check-updates']
  329. }
  330. #Fail if we're on any other CentOS release:
  331. default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release version!") }
  332. }
  333. }
  334. #Ubuntu systems:
  335. 'Ubuntu': {
  336. case $::operatingsystemrelease {
  337. #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available...
  338. '12.04': {
  339. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-extra', 'nagios-nrpe-plugin']
  340. #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:
  341. $client_plugin_package_install_options = '--no-install-recommends'
  342. }
  343. #...but 14.04 does:
  344. '14.04': {
  345. $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']
  346. #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:
  347. $client_plugin_package_install_options = '--no-install-recommends'
  348. }
  349. #Fail if we're on any other Ubuntu release:
  350. default: { fail("${::operatingsystemmajrelease} is not a supported Ubuntu release version!") }
  351. }
  352. }
  353. #Debian systems:
  354. 'Debian': {
  355. case $::operatingsystemmajrelease {
  356. '7': {
  357. $icinga2_client_packages = ['nagios-nrpe-server', 'nagios-plugins', 'nagios-plugins-basic', 'nagios-plugins-standard', 'nagios-snmp-plugins', 'nagios-plugins-contrib', 'nagios-nrpe-plugin']
  358. #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:
  359. $client_plugin_package_install_options = '--no-install-recommends'
  360. }
  361. #Fail if we're on any other Debian release:
  362. default: { fail("${::operatingsystemmajrelease} is not a supported Debian release version!") }
  363. }
  364. }
  365. #Fail if we're on any other OS:
  366. default: { fail("${::operatingsystem} is not supported!") }
  367. }
  368. ##################
  369. # Icinga 2 client service parameters
  370. case $::operatingsystem {
  371. #Daemon names for Red Had/CentOS systems:
  372. 'CentOS': {
  373. $nrpe_daemon_name = 'nrpe'
  374. }
  375. #Daemon names for Ubuntu systems:
  376. 'Ubuntu': {
  377. $nrpe_daemon_name = 'nagios-nrpe-server'
  378. }
  379. #Daemon names for Debian systems:
  380. 'Debian': {
  381. $nrpe_daemon_name = 'nagios-nrpe-server'
  382. }
  383. #Fail if we're on any other OS:
  384. default: { fail("${::operatingsystem} is not supported!") }
  385. }
  386. }