notificationcomponent.pp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # == Defined type: icinga2::object::notificationcomponent
  2. #
  3. # This is a defined type for Icinga 2 apply objects that create Notification Component
  4. # See the following Icinga 2 doc page for more info:
  5. # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-notificationcomponent
  6. #
  7. # === Parameters
  8. #
  9. # See the inline comments.
  10. #
  11. define icinga2::object::notificationcomponent (
  12. $ensure = 'file',
  13. $object_name = $name,
  14. $enable_ha = undef,
  15. $target_dir = '/etc/icinga2/features-available',
  16. $target_file_name = "${name}.conf",
  17. $target_file_owner = 'root',
  18. $target_file_group = 'root',
  19. $target_file_mode = '0644'
  20. ) {
  21. if $enable_ha {
  22. validate_bool($enable_ha)
  23. }
  24. validate_string($target_dir)
  25. validate_string($target_file_name)
  26. validate_string($target_file_owner)
  27. validate_string($target_file_group)
  28. validate_re($target_file_mode, '^\d{4}$')
  29. file {"${target_dir}/${target_file_name}":
  30. ensure => $ensure,
  31. owner => $target_file_owner,
  32. group => $target_file_group,
  33. mode => $target_file_mode,
  34. content => template('icinga2/object_notificationcomponent.conf.erb'),
  35. # notify => Service['icinga2'], # Dont need to reload/restart the service only enable/disable the feature. Should we force enable/disable the feature (icinga2 feature enable notification) or should the user define it?
  36. }
  37. }