3
0

OP#188 create directory

This commit is contained in:
2025-12-04 11:59:41 +01:00
parent 933d97d038
commit 747b0f22d1
2 changed files with 24 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
class prometheus_cd::main::dirs ( 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 directory # prometheus directory
file { $ps_main_dir: file { $ps_main_dir:
ensure => directory, ensure => directory,
@@ -18,7 +18,7 @@ class prometheus_cd::main::dirs (
seltype => etc_t, seltype => etc_t,
seluser => system_u, seluser => system_u,
} }
# service systemfile directory # service system file directory
file { $ps_system_file_dir: file { $ps_system_file_dir:
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
@@ -29,5 +29,22 @@ class prometheus_cd::main::dirs (
seltype => systemd_unit_file_t, seltype => systemd_unit_file_t,
seluser => unconfined_u, seluser => unconfined_u,
} }
if $ps_write_external == true {
file { $ps_pruning_dir:
ensure => directory,
owner => 'prometheus',
group => 'prometheus',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => usr_,
seluser => unconfined_u,
}
}
if $ps_write_external == false {
file { $ps_pruning_dir:
ensure => absent,
}
}
} }
} }

View File

@@ -28,6 +28,7 @@
# @param [String] ps_auth_ext_user user for writing to extern instance # @param [String] ps_auth_ext_user user for writing to extern instance
# @param [String] ps_auth_ext_pass password for writing to extern instance # @param [String] ps_auth_ext_pass password for writing to extern instance
# @param [String] ps_external_url the full url for the remote write point # @param [String] ps_external_url the full url for the remote write point
# @param [String] ps_pruning_dir the directory for the pruning script
############################################################################## ##############################################################################
class prometheus_cd::params ( class prometheus_cd::params (
@@ -71,7 +72,10 @@ class prometheus_cd::params (
# remote write external # remote write external
Boolean $ps_write_external = false, Boolean $ps_write_external = false,
String $ps_external_url = 'http://change.local', String $ps_external_url = 'http://changeme.local/write',
# pruning script
String $ps_pruning_dir = '/opt/prometheus-prune'
) { ) {
# defaults # defaults