forked from DataDog/puppet-datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneric.pp
More file actions
57 lines (53 loc) · 1.8 KB
/
generic.pp
File metadata and controls
57 lines (53 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
# Class: datadog_agent::integrations::generic
#
# This class will install a configuration file for an integration
#
# Parameters:
# $integration_name:
# This will be used to build the filename. It must correspond to an
# integration that is supported by dd-agent, see the dd-agent for
# a current list.
# $integration_contents:
# String containing a rendered template.
#
# Sample Usage:
#
# class { 'datadog_agent::integrations::generic':
# integration_name => 'custom',
# integration_contents => template(my_custom_template),
# }
#
class datadog_agent::integrations::generic(
Optional[String] $integration_name = undef,
Optional[String] $integration_contents = undef,
) inherits datadog_agent::params {
validate_legacy('Optional[String]', 'validate_string', $integration_name)
validate_legacy('Optional[String]', 'validate_string', $integration_contents)
$legacy_dst = "${datadog_agent::conf_dir}/${integration_name}.yaml"
if !$::datadog_agent::agent5_enable {
$dst_dir = "${datadog_agent::conf6_dir}/${integration_name}.d"
file { $legacy_dst:
ensure => 'absent'
}
file { $dst_dir:
ensure => directory,
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0755',
require => Package[$datadog_agent::params::package_name],
notify => Service[$datadog_agent::params::service_name]
}
$dst = "${dst_dir}/conf.yaml"
} else {
$dst = $legacy_dst
}
file { $dst:
ensure => file,
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0600',
content => $integration_contents,
require => Package[$datadog_agent::params::package_name],
notify => Service[$datadog_agent::params::service_name]
}
}