params.pp 17 KB

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