3
0
This commit is contained in:
Arne Teuke
2025-10-18 15:29:20 +02:00
parent 1dec72f087
commit 173fc542f8
5 changed files with 38 additions and 4 deletions

View File

@@ -25,7 +25,6 @@ INSTALLATION
CONFIGURATION CONFIGURATION
* manage directories and files including templates * manage directories and files including templates
* manages the main alloy jenkins for loki and prometheus
* manage service * manage service
## Repo Documentation ## Repo Documentation

View File

@@ -7,7 +7,7 @@ class prometheus_cd::main::dirs (
) inherits prometheus_cd::params { ) inherits prometheus_cd::params {
require prometheus_cd::main::install require prometheus_cd::main::install
if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) { if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) {
# prometheus directors # prometheus directory
file { $ps_main_dir: file { $ps_main_dir:
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
@@ -18,5 +18,16 @@ class prometheus_cd::main::dirs (
seltype => etc_t, seltype => etc_t,
seluser => system_u, seluser => system_u,
} }
# service systemfile directory
file { $ps_system_file_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => systemd_unit_file_t,
seluser => unconfined_u,
}
} }
} }

View File

@@ -5,8 +5,8 @@
############################################################################## ##############################################################################
class prometheus_cd::main::files ( class prometheus_cd::main::files (
) inherits prometheus_cd::params { ) inherits prometheus_cd::params {
require prometheus_cd::main::dirs if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) {
if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) { require prometheus_cd::main::dirs
file { $ps_main_file: file { $ps_main_file:
ensure => file, ensure => file,
owner => 'root', owner => 'root',
@@ -19,5 +19,17 @@ class prometheus_cd::main::files (
content => template('prometheus_cd/prometheus.yml.erb'), content => template('prometheus_cd/prometheus.yml.erb'),
notify => Service[$ps_prom_service], notify => Service[$ps_prom_service],
} }
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],
}
} }
} }

View File

@@ -44,9 +44,11 @@ class prometheus_cd::params (
# dirs # dirs
$ps_main_dir = '/etc/prometheus' $ps_main_dir = '/etc/prometheus'
$ps_system_file_dir = '/etc/systemd/system/prometheus.service.d'
# files # files
$ps_main_file = "${ps_main_dir}/prometheus.yml" $ps_main_file = "${ps_main_dir}/prometheus.yml"
$ps_system_service_file = "${ps_system_file_dir}/override.conf"
# services # services
$ps_prom_service = 'prometheus' $ps_prom_service = 'prometheus'

View File

@@ -0,0 +1,10 @@
##############################################################################
##### File created by Puppet - manual changes will be overwritten #####
###############################################################################
[Service]
ExecStart=
ExecStart=/usr/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.enable-remote-write-receiver \
--web.enable-lifecycle