2025-06-13 14:48:19 +02:00
|
|
|
# prometheus_cd::main::files.pp
|
|
|
|
|
# Module name: prometheus_cd
|
|
|
|
|
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
|
|
|
|
# @summary Class manages configuration files for the prometheus_cd module.
|
|
|
|
|
##############################################################################
|
|
|
|
|
class prometheus_cd::main::files (
|
|
|
|
|
) inherits prometheus_cd::params {
|
2025-12-03 16:39:02 +01:00
|
|
|
if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) {
|
2025-10-18 15:29:20 +02:00
|
|
|
require prometheus_cd::main::dirs
|
2025-10-18 13:59:28 +02:00
|
|
|
file { $ps_main_file:
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => 'root',
|
|
|
|
|
group => 'root',
|
|
|
|
|
mode => '0644',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => etc_t,
|
|
|
|
|
seluser => system_u,
|
|
|
|
|
content => template('prometheus_cd/prometheus.yml.erb'),
|
|
|
|
|
notify => Service[$ps_prom_service],
|
|
|
|
|
}
|
2025-10-18 15:29:20 +02:00
|
|
|
file { $ps_system_service_file:
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => 'root',
|
|
|
|
|
group => 'root',
|
|
|
|
|
mode => '0644',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => systemd_unit_file_t,
|
|
|
|
|
seluser => unconfined_u,
|
|
|
|
|
content => template('prometheus_cd/override.conf.erb'),
|
|
|
|
|
notify => Service[$ps_prom_service],
|
|
|
|
|
}
|
2025-10-18 16:30:54 +02:00
|
|
|
file { $ps_web_config_file:
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => 'root',
|
|
|
|
|
group => 'root',
|
|
|
|
|
mode => '0644',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => etc_t,
|
|
|
|
|
seluser => system_u,
|
|
|
|
|
content => template('prometheus_cd/web.yml.erb'),
|
|
|
|
|
notify => Service[$ps_prom_service],
|
|
|
|
|
}
|
2025-12-04 12:15:20 +01:00
|
|
|
if $ps_enable_pruning == true {
|
|
|
|
|
file { $ps_pruning_file:
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => 'prometheus',
|
|
|
|
|
group => 'prometheus',
|
|
|
|
|
mode => '0750',
|
|
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => usr_,
|
|
|
|
|
seluser => unconfined_u,
|
|
|
|
|
content => template('prometheus_cd/prune_blocks.erb'),
|
|
|
|
|
# notify Service ToDo,
|
|
|
|
|
}
|
2025-12-04 13:11:43 +01:00
|
|
|
file { $ps_env_file:
|
|
|
|
|
ensure => file,
|
|
|
|
|
owner => 'prometheus',
|
|
|
|
|
group => 'prometheus',
|
2025-12-04 13:23:59 +01:00
|
|
|
mode => '0440',
|
2025-12-04 13:11:43 +01:00
|
|
|
selrange => s0,
|
|
|
|
|
selrole => object_r,
|
|
|
|
|
seltype => usr_,
|
|
|
|
|
seluser => unconfined_u,
|
|
|
|
|
content => template('prometheus_cd/prune.env.erb'),
|
|
|
|
|
# notify Service ToDo,
|
|
|
|
|
}
|
2025-12-04 12:15:20 +01:00
|
|
|
}
|
2025-12-04 13:11:43 +01:00
|
|
|
|
2025-12-04 12:15:20 +01:00
|
|
|
if $ps_enable_pruning == false {
|
2025-12-04 12:28:19 +01:00
|
|
|
file { $ps_pruning_file:
|
2025-12-04 12:15:20 +01:00
|
|
|
ensure => absent,
|
2025-12-04 13:11:43 +01:00
|
|
|
# notify Service ToDo,
|
|
|
|
|
}
|
|
|
|
|
file { $ps_env_file:
|
|
|
|
|
ensure => absent,
|
|
|
|
|
# notify Service ToDo,
|
2025-12-04 12:15:20 +01:00
|
|
|
}
|
|
|
|
|
}
|
2025-10-18 13:08:50 +02:00
|
|
|
}
|
2025-06-13 14:48:19 +02:00
|
|
|
}
|