Defined Type: sensu::write_json
- Defined in:
- manifests/write_json.pp
Summary
Writes arbitrary hash data to a config file.Overview
Writes arbitrary hash data to a config file. Note: you must manually notify any Sensu services to restart them when using this defined resource type.
[notify_list] Array. A listing of resources to notify upon changes to the target JSON file. Default: []
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'manifests/write_json.pp', line 32
define sensu::write_json (
Enum['present', 'absent'] $ensure = 'present',
String $owner = 'sensu',
String $group = 'sensu',
Stdlib::Filemode $mode = '0775',
Boolean $pretty = true,
Hash $content = {},
Array[Variant[Data,Type]] $notify_list = [],
) {
# ensure we have a properly formatted file path for our target OS
case $::kernel {
'windows': {
assert_type(Stdlib::Windowspath, $title)
}
default: {
assert_type(Stdlib::Unixpath, $title)
}
}
# Write the config file, using the native file resource and the
# sensu_sorted_json function to format/sort the json.
file { $title :
ensure => $ensure,
owner => $owner,
group => $group,
mode => $mode,
content => sensu_sorted_json($content, $pretty),
notify => $notify_list,
}
}
|