Skip to content

Commit

Permalink
also allow parameterizing prometheus's own name
Browse files Browse the repository at this point in the history
  • Loading branch information
unki committed Feb 28, 2020
1 parent c1d09d5 commit 303a043
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ prometheus::version: '2.14.0'
prometheus::install_method: 'url'
prometheus::manage_prometheus_server: false
prometheus::extract_command: ~
prometheus::service_name: 'prometheus'
prometheus::pushprox_client::download_extension: 'tar.gz'
prometheus::pushprox_client::download_url_base: 'https://github.com/camptocamp/PushProx/releases'
prometheus::pushprox_client::extra_groups: []
Expand Down
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
'redhat' => template('prometheus/prometheus.sysv.erb'), # redhat and sysv share the same template file
default => template("prometheus/prometheus.${prometheus::server::init_style}.erb"),
}
file { '/etc/init.d/prometheus':
file { "/etc/init.d/${prometheus::server::service_name}":
ensure => file,
mode => '0555',
owner => 'root',
Expand Down Expand Up @@ -252,7 +252,7 @@
file_sd_configs => [{
files => [ "${prometheus::config_dir}/file_sd_config.d/${job_name}_*.yaml" ]
}]
})
})
}

if versioncmp($prometheus::server::version, '2.0.0') >= 0 {
Expand Down
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
# Whether to enable or not prometheus service from puppet (default true)
# @param service_ensure
# State ensured from prometheus service (default 'running')
# @param service_name
# Name of the prometheus service (default 'prometheus')
# @param manage_service
# Should puppet manage the prometheus service? (default true)
# @param restart_on_change
Expand Down Expand Up @@ -219,6 +221,7 @@
String $download_extension,
String $package_name,
String $package_ensure,
String $service_name,
String $config_dir,
Stdlib::Absolutepath $localstorage,
String $config_template,
Expand Down
2 changes: 1 addition & 1 deletion manifests/run_service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$init_selector = $prometheus::server::init_style ? {
'launchd' => 'io.prometheus.daemon',
default => 'prometheus',
default => $prometheus::server::service_name,
}

if $prometheus::server::manage_service == true {
Expand Down
3 changes: 2 additions & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
Hash $extra_alerts = $prometheus::extra_alerts,
Boolean $service_enable = $prometheus::service_enable,
Stdlib::Ensure::Service $service_ensure = $prometheus::service_ensure,
String[1] $service_name = $prometheus::service_name,
Boolean $manage_service = $prometheus::manage_service,
Boolean $restart_on_change = $prometheus::restart_on_change,
Prometheus::Initstyle $init_style = $facts['service_provider'],
Expand Down Expand Up @@ -56,7 +57,7 @@
"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
}
$notify_service = $restart_on_change ? {
true => Service['prometheus'],
true => Service[$service_name],
default => undef,
}

Expand Down

0 comments on commit 303a043

Please sign in to comment.