params.pp 15 KB

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