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 variable for config_file_mode und config_folder_mode #108

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
content => template('telegraf/telegraf.conf.erb'),
owner => $telegraf::config_file_owner,
group => $telegraf::config_file_group,
mode => '0640',
mode => $telegraf::config_file_mode,
}
file { $telegraf::config_folder:
ensure => directory,
owner => $telegraf::config_file_owner,
group => $telegraf::config_file_group,
mode => '0770',
mode => $telegraf::config_folder_mode,
purge => $telegraf::purge_config_fragments,
recurse => true,
}
Expand Down
72 changes: 40 additions & 32 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@
# [*config_file_group*]
# String. Group to own the telegraf config file.
#
# [*config_file_mode*]
# String. File mode for the telegraf config file.
#
# [*config_folder*]
# String. Path of additional telegraf config files.
# String. Path of additional telegraf config folder.
#
# [*config_folder_mode*]
# String. File mode for the telegraf config folder.
#
# [*hostname*]
# String. Override default hostname used to identify this agent.
Expand Down Expand Up @@ -90,37 +96,39 @@
# String. URL for windows telegraf chocolatey repo
#
class telegraf (
String $package_name = $telegraf::params::package_name,
String $ensure = $telegraf::params::ensure,
String $config_file = $telegraf::params::config_file,
String $config_file_owner = $telegraf::params::config_file_owner,
String $config_file_group = $telegraf::params::config_file_group,
String $config_folder = $telegraf::params::config_folder,
String $hostname = $telegraf::params::hostname,
Boolean $omit_hostname = $telegraf::params::omit_hostname,
String $interval = $telegraf::params::interval,
Boolean $round_interval = $telegraf::params::round_interval,
Integer $metric_batch_size = $telegraf::params::metric_batch_size,
Integer $metric_buffer_limit = $telegraf::params::metric_buffer_limit,
String $collection_jitter = $telegraf::params::collection_jitter,
String $flush_interval = $telegraf::params::flush_interval,
String $flush_jitter = $telegraf::params::flush_jitter,
String $precision = $telegraf::params::precision,
String $logfile = $telegraf::params::logfile,
Boolean $debug = $telegraf::params::debug,
Boolean $quiet = $telegraf::params::quiet,
Hash $inputs = $telegraf::params::inputs,
Hash $outputs = $telegraf::params::outputs,
Hash $global_tags = $telegraf::params::global_tags,
Boolean $manage_service = $telegraf::params::manage_service,
Boolean $manage_repo = $telegraf::params::manage_repo,
Optional[String] $repo_location = $telegraf::params::repo_location,
Boolean $purge_config_fragments = $telegraf::params::purge_config_fragments,
String $repo_type = $telegraf::params::repo_type,
String $windows_package_url = $telegraf::params::windows_package_url,
Boolean $service_enable = $telegraf::params::service_enable,
String $service_ensure = $telegraf::params::service_ensure,
Array $install_options = $telegraf::params::install_options,
String $package_name = $telegraf::params::package_name,
String $ensure = $telegraf::params::ensure,
String $config_file = $telegraf::params::config_file,
String $config_file_owner = $telegraf::params::config_file_owner,
String $config_file_group = $telegraf::params::config_file_group,
Stdlib::Filemode $config_file_mode = $telegraf::params::config_file_mode,
String $config_folder = $telegraf::params::config_folder,
Stdlib::Filemode $config_folder_mode = $telegraf::params::config_folder_mode,
String $hostname = $telegraf::params::hostname,
Boolean $omit_hostname = $telegraf::params::omit_hostname,
String $interval = $telegraf::params::interval,
Boolean $round_interval = $telegraf::params::round_interval,
Integer $metric_batch_size = $telegraf::params::metric_batch_size,
Integer $metric_buffer_limit = $telegraf::params::metric_buffer_limit,
String $collection_jitter = $telegraf::params::collection_jitter,
String $flush_interval = $telegraf::params::flush_interval,
String $flush_jitter = $telegraf::params::flush_jitter,
String $precision = $telegraf::params::precision,
String $logfile = $telegraf::params::logfile,
Boolean $debug = $telegraf::params::debug,
Boolean $quiet = $telegraf::params::quiet,
Hash $inputs = $telegraf::params::inputs,
Hash $outputs = $telegraf::params::outputs,
Hash $global_tags = $telegraf::params::global_tags,
Boolean $manage_service = $telegraf::params::manage_service,
Boolean $manage_repo = $telegraf::params::manage_repo,
Optional[String] $repo_location = $telegraf::params::repo_location,
Boolean $purge_config_fragments = $telegraf::params::purge_config_fragments,
String $repo_type = $telegraf::params::repo_type,
String $windows_package_url = $telegraf::params::windows_package_url,
Boolean $service_enable = $telegraf::params::service_enable,
String $service_ensure = $telegraf::params::service_ensure,
Array $install_options = $telegraf::params::install_options,
) inherits telegraf::params
{

Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
$config_file = '/etc/telegraf/telegraf.conf'
$config_file_owner = 'telegraf'
$config_file_group = 'telegraf'
$config_file_mode = '0640'
$config_folder = '/etc/telegraf/telegraf.d'
$config_folder_mode = '0770'
$logfile = ''
$manage_repo = true
$repo_location = 'https://repos.influxdata.com/'
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"dependencies": [
{
"name": "puppetlabs-stdlib",
"version_requirement": ">=4.10.0 < 6.0.0"
"version_requirement": ">=5.0.0 < 6.0.0"
},
{
"name": "puppetlabs-apt",
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/telegraf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
metric_batch_size: '1000',
metric_buffer_limit: '10000',
flush_interval: '60s',
config_file_mode: '0640',
config_folder_mode: '0770',
global_tags: {
'dc' => 'dc',
'env' => 'production',
Expand Down
2 changes: 2 additions & 0 deletions spec/hieradata/test/telegraf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
telegraf::ensure: "1.3.5-1"
telegraf::interval: "60s"
telegraf::flush_interval: "60s"
telegraf::config_file_mode: '0640'
telegraf::config_folder_mode: '0770'
telegraf::global_tags:
role: "telegraf"
env: "production"
Expand Down