Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add env vars and env file path #616

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_enable = true,
Boolean $manage_service = true,
Boolean $env_vars_sensitive = false,
duonghoangle marked this conversation as resolved.
Show resolved Hide resolved
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $extract_command = $prometheus::extract_command,
Expand Down Expand Up @@ -248,16 +249,17 @@
# those files to be present, even if empty, so it's critical that
# the file not get removed
file { "${env_file_path}/${name}":
mode => '0644',
owner => 'root',
group => '0', # Darwin uses wheel
content => epp(
mode => '0644',
owner => 'root',
group => '0', # Darwin uses wheel
content => epp(
'prometheus/daemon.env.epp',
{
'env_vars' => $env_vars_merged,
}
),
notify => $notify_service,
notify => $notify_service,
show_diff => !$env_vars_sensitive,
}
}

Expand Down
12 changes: 12 additions & 0 deletions manifests/elasticsearch_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::elasticsearch_exporter (
String[1] $cnf_uri,
String[1] $cnf_timeout,
Expand Down Expand Up @@ -89,6 +95,9 @@
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Boolean $env_vars_sensitive = false,
duonghoangle marked this conversation as resolved.
Show resolved Hide resolved
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
) inherits prometheus {
#Please provide the download_url for versions < 0.9.0
$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -134,5 +143,8 @@
scrape_job_labels => $scrape_job_labels,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
}
}