From 3b20a4a5665174eb9edb1d7ea78d691fcc1ebebc Mon Sep 17 00:00:00 2001 From: 12ww1160 Date: Thu, 4 Dec 2025 12:15:20 +0100 Subject: [PATCH] OP#188 create file --- README.md | 6 ++++++ manifests/main/files.pp | 19 +++++++++++++++++++ manifests/params.pp | 1 + wiki/pruning.md | 1 + 4 files changed, 27 insertions(+) create mode 100644 wiki/pruning.md diff --git a/README.md b/README.md index 35d3a9f..80140c4 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,17 @@ Configurable options: - `ps_external_url` must be a valid full url - `ps_auth_ext_user`must be a valid user - `ps_auth_ext_pass`must be a valid password +- pruning local blocks + - `ps_enable_pruning` true enables it + - `ps_pruning_dir` the directory where the pruning script should live ## Puppet Documentation See the full Puppet documentation including parameters in `docs/index.html` +# Wiki +[Pruning process](/wiki/pruning.md) + ## Dependencies All dependencies must be included in the catalogue. diff --git a/manifests/main/files.pp b/manifests/main/files.pp index ce695f3..b8a6b73 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -43,5 +43,24 @@ class prometheus_cd::main::files ( content => template('prometheus_cd/web.yml.erb'), notify => Service[$ps_prom_service], } + 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, + } + } + if $ps_enable_pruning == false { + file { $ps_pruning_fir: + ensure => absent, + } + } } } diff --git a/manifests/params.pp b/manifests/params.pp index 16d5dc7..e163d2a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -78,6 +78,7 @@ class prometheus_cd::params ( # pruning script Boolean $ps_enable_pruning = false, String $ps_pruning_dir = '/opt/prometheus-prune', + String $ps_pruning_file = "${ps_pruning_dir}/prune_prometheus_pg.sh", ) { # defaults diff --git a/wiki/pruning.md b/wiki/pruning.md new file mode 100644 index 0000000..94ac03a --- /dev/null +++ b/wiki/pruning.md @@ -0,0 +1 @@ +# The Pruning Process \ No newline at end of file