params.pp 15 KB

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