Puppet Class: otelcol::config
- Inherits:
- otelcol
- Defined in:
- manifests/config.pp
Overview
Class: otelcol::config
Templated generation of otelcol.conf
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'manifests/config.pp', line 5
class otelcol::config inherits otelcol {
assert_private()
$component = {
'service' => {
'telemetry' => {
'logs' => $otelcol::log_options,
'metrics' => {
'level' => $otelcol::metrics_level,
'address' => "${otelcol::metrics_address_host}:${otelcol::metrics_address_port}",
},
},
},
}
concat { 'otelcol-config' :
ensure => present,
path => $otelcol::config_file,
format => 'yaml',
owner => $otelcol::config_file_owner,
group => $otelcol::config_file_group,
mode => $otelcol::config_file_mode,
}
concat::fragment { 'otelcol-config-header' :
target => 'otelcol-config',
order => 0,
content => '# File Managed by Puppet',
}
concat::fragment { 'otelcol-config-baseconfig' :
target => 'otelcol-config',
order => 10000,
content => stdlib::to_yaml($component),
}
file { 'otelcol-environment' :
ensure => 'file',
path => $otelcol::environment_file,
content => template('otelcol/environment.conf.erb'),
owner => $otelcol::config_file_owner,
group => $otelcol::config_file_group,
mode => $otelcol::config_file_mode,
}
$otelcol::receivers.each |String $rname, Hash $rvalue| {
if $rvalue['config'] =~ Hash {
ensure_resource('otelcol::receiver', $rname, $rvalue)
} else {
ensure_resource('otelcol::receiver', $rname, { 'config' => $rvalue })
}
}
$otelcol::processors.each |String $rname, Hash $rvalue| {
if $rvalue['config'] =~ Hash {
ensure_resource('otelcol::processor', $rname, $rvalue)
} else {
ensure_resource('otelcol::processor', $rname, { 'config' => $rvalue })
}
}
$otelcol::exporters.each |String $rname, Hash $rvalue| {
if $rvalue['config'] =~ Hash {
ensure_resource('otelcol::exporter', $rname, $rvalue)
}
else {
ensure_resource('otelcol::exporter', $rname, { 'config' => $rvalue })
}
}
$otelcol::pipelines.each |String $rname, Hash $rvalue| {
if $rvalue['config'] =~ Hash {
ensure_resource('otelcol::pipeline', $rname, $rvalue)
}
else {
ensure_resource('otelcol::pipeline', $rname, { 'config' => $rvalue })
}
}
$otelcol::extensions.each |String $rname, Hash $rvalue| {
if $rvalue['config'] =~ Hash {
ensure_resource('otelcol::extension', $rname, $rvalue)
}
else {
ensure_resource('otelcol::extension', $rname, { 'config' => $rvalue })
}
}
}
|