From 173fc542f8600c2f8ebb9ac5859a65a67ef14902 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Sat, 18 Oct 2025 15:29:20 +0200 Subject: [PATCH 1/2] add service override file to allow config flags - https://gitlab.confdroid.com/internal/confdroid_management/-/issues/260 --- README.md | 1 - manifests/main/dirs.pp | 13 ++++++++++++- manifests/main/files.pp | 16 ++++++++++++++-- manifests/params.pp | 2 ++ templates/override.conf.erb.erb | 10 ++++++++++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 templates/override.conf.erb.erb diff --git a/README.md b/README.md index cb8986b..1ec56f0 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ INSTALLATION CONFIGURATION * manage directories and files including templates -* manages the main alloy jenkins for loki and prometheus * manage service ## Repo Documentation diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp index 31126c6..ba46ea2 100644 --- a/manifests/main/dirs.pp +++ b/manifests/main/dirs.pp @@ -7,7 +7,7 @@ class prometheus_cd::main::dirs ( ) inherits prometheus_cd::params { require prometheus_cd::main::install if ($ps_prom_host == $fqdn) and ($manage_prometheus == true) { - # prometheus directors + # prometheus directory file { $ps_main_dir: ensure => directory, owner => 'root', @@ -18,5 +18,16 @@ class prometheus_cd::main::dirs ( seltype => etc_t, 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, + } } } diff --git a/manifests/main/files.pp b/manifests/main/files.pp index a7529c9..06011b3 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -5,8 +5,8 @@ ############################################################################## class prometheus_cd::main::files ( ) 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: ensure => file, owner => 'root', @@ -19,5 +19,17 @@ class prometheus_cd::main::files ( content => template('prometheus_cd/prometheus.yml.erb'), 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], + } } } diff --git a/manifests/params.pp b/manifests/params.pp index c6f0a22..6381c2f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -44,9 +44,11 @@ class prometheus_cd::params ( # dirs $ps_main_dir = '/etc/prometheus' + $ps_system_file_dir = '/etc/systemd/system/prometheus.service.d' # files $ps_main_file = "${ps_main_dir}/prometheus.yml" + $ps_system_service_file = "${ps_system_file_dir}/override.conf" # services $ps_prom_service = 'prometheus' diff --git a/templates/override.conf.erb.erb b/templates/override.conf.erb.erb new file mode 100644 index 0000000..97e5da5 --- /dev/null +++ b/templates/override.conf.erb.erb @@ -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 \ No newline at end of file From ede5319ac4ba089268e7d91edff9c7f8d507e20a Mon Sep 17 00:00:00 2001 From: Jenkins Server Date: Sat, 18 Oct 2025 15:30:37 +0200 Subject: [PATCH 2/2] Recommit for updates in build 26 --- doc/file.README.html | 2 -- doc/index.html | 2 -- .../prometheus_cd_3A_3Amain_3A_3Adirs.html | 26 ++++++++++++++-- .../prometheus_cd_3A_3Amain_3A_3Afiles.html | 30 +++++++++++++++++-- .../prometheus_cd_3A_3Aparams.html | 6 +++- 5 files changed, 56 insertions(+), 10 deletions(-) diff --git a/doc/file.README.html b/doc/file.README.html index 19eb6cd..b3a1a3f 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -87,8 +87,6 @@ diff --git a/doc/index.html b/doc/index.html index 8f24fbf..ea25804 100644 --- a/doc/index.html +++ b/doc/index.html @@ -87,8 +87,6 @@ diff --git a/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Adirs.html b/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Adirs.html index 540bff1..789e8a6 100644 --- a/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Adirs.html +++ b/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Adirs.html @@ -117,7 +117,18 @@ 19 20 21 -22 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33
# File 'manifests/main/dirs.pp', line 6
@@ -126,7 +137,7 @@ class prometheus_cd::main::dirs (
 ) inherits prometheus_cd::params {
   require prometheus_cd::main::install
   if ($ps_prom_host == $fqdn) and ($manage_prometheus == true)  {
-    # prometheus directors
+    # prometheus directory
     file { $ps_main_dir:
       ensure   => directory,
       owner    => 'root',
@@ -137,6 +148,17 @@ class prometheus_cd::main::dirs (
       seltype  => etc_t,
       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,
+    }
   }
 }
diff --git a/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Afiles.html b/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Afiles.html index 3d626a5..9d95201 100644 --- a/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Afiles.html +++ b/doc/puppet_classes/prometheus_cd_3A_3Amain_3A_3Afiles.html @@ -118,15 +118,27 @@ 20 21 22 -23 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35
# File 'manifests/main/files.pp', line 6
 
 class prometheus_cd::main::files (
 ) 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:
       ensure   => file,
       owner    => 'root',
@@ -139,6 +151,18 @@ class prometheus_cd::main::files (
       content  => template('prometheus_cd/prometheus.yml.erb'),
       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],
+    }
   }
 }
diff --git a/doc/puppet_classes/prometheus_cd_3A_3Aparams.html b/doc/puppet_classes/prometheus_cd_3A_3Aparams.html index 651cb71..b70075d 100644 --- a/doc/puppet_classes/prometheus_cd_3A_3Aparams.html +++ b/doc/puppet_classes/prometheus_cd_3A_3Aparams.html @@ -359,7 +359,9 @@ 54 55 56 -57 +57 +58 +59
# File 'manifests/params.pp', line 17
@@ -394,9 +396,11 @@ class prometheus_cd::params (
 
   # dirs
   $ps_main_dir            = '/etc/prometheus'
+  $ps_system_file_dir     = '/etc/systemd/system/prometheus.service.d'
 
   # files
   $ps_main_file           = "${ps_main_dir}/prometheus.yml"
+  $ps_system_service_file = "${ps_system_file_dir}/override.conf"
 
   # services
   $ps_prom_service        = 'prometheus'