dependency.pp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # == Defined type: icinga2::object::dependency
  2. #
  3. # This is a defined type for Icinga 2 dependency objects.
  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-dependency
  6. #
  7. # === Parameters
  8. #
  9. # See the inline comments.
  10. #
  11. define icinga2::object::dependency (
  12. $object_name = $name,
  13. $display_name = $name,
  14. $parent_host_name = $host_name,
  15. $parent_service_name = undef,
  16. $child_host_name = undef,
  17. $child_service_name = undef,
  18. $disable_checks = undef,
  19. $disable_notifications = undef,
  20. $period = undef,
  21. $states = [],
  22. $target_dir = '/etc/icinga2/conf.d',
  23. $target_file_name = "${name}.conf",
  24. $target_file_owner = 'root',
  25. $target_file_group = 'root',
  26. $target_file_mode = '0644') {
  27. # Do some validation of the class' parameters:
  28. validate_string($object_name)
  29. validate_string($display_name)
  30. validate_string($host_name)
  31. validate_string($parent_host_name)
  32. validate_string($child_host_name)
  33. validate_string($child_service_name)
  34. validate_string($parent_service_name)
  35. # validate_bool($disable_checks)
  36. # validate_bool($disable_notifications)
  37. validate_string($period)
  38. validate_array($states)
  39. validate_string($target_dir)
  40. validate_string($target_file_name)
  41. validate_string($target_file_owner)
  42. validate_string($target_file_group)
  43. validate_string($target_file_mode)
  44. file { "${target_dir}/${target_file_name}":
  45. ensure => file,
  46. owner => $target_file_owner,
  47. group => $target_file_group,
  48. mode => $target_file_mode,
  49. content => template('icinga2/object_dependency.conf.erb'),
  50. notify => Service['icinga2'],
  51. }
  52. }