mirror of
https://github.com/krislamo/puppet-fluentd
synced 2024-11-10 04:50:34 +00:00
added fluentd::service
configures the fluentd (td-agent) service
This commit is contained in:
parent
adb39eabf0
commit
600970d5df
@ -48,19 +48,31 @@ class fluentd (
|
||||
$package_ensure = $::fluentd::params::package_ensure,
|
||||
$package_name = $::fluentd::params::package_name,
|
||||
$package_install_options = $::fluentd::params::package_install_options,
|
||||
$service_manage = $::fluentd::params::service_manage,
|
||||
$service_name = $::fluentd::params::service_name,
|
||||
$service_ensure = $::fluentd::params::service_ensure,
|
||||
$service_enable = $::fluentd::params::service_enable,
|
||||
) inherits fluentd::params {
|
||||
|
||||
# parameter validation
|
||||
validate_string($ensure)
|
||||
validate_bool($manage_repo)
|
||||
validate_string($package_ensure)
|
||||
validate_string($package_name)
|
||||
validate_array($package_install_options)
|
||||
validate_bool($service_manage)
|
||||
validate_string($service_name)
|
||||
validate_bool($service_enable)
|
||||
if ! ($service_ensure in [ 'running', 'stopped' ]) {
|
||||
fail('service_ensure parameter must be running or stopped')
|
||||
}
|
||||
|
||||
if $manage_repo {
|
||||
class { '::fluentd::repo': }
|
||||
}
|
||||
|
||||
class { '::fluentd::install': } ->
|
||||
class { '::fluentd::config': }
|
||||
class { '::fluentd::config': } ->
|
||||
class { '::fluentd::service': }
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
class fluentd::params {
|
||||
$ensure = 'present'
|
||||
|
||||
# package params
|
||||
$package_ensure = 'installed'
|
||||
$package_name = 'td-agent'
|
||||
$package_install_options = []
|
||||
# service params
|
||||
$service_manage = true
|
||||
$service_name = 'td-agent'
|
||||
$service_ensure = 'running'
|
||||
$service_enable = true
|
||||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
|
14
manifests/service.pp
Normal file
14
manifests/service.pp
Normal file
@ -0,0 +1,14 @@
|
||||
# Configure package
|
||||
#
|
||||
class fluentd::service inherits fluentd {
|
||||
|
||||
if $service_manage {
|
||||
service { 'fluentd':
|
||||
name => $service_name,
|
||||
ensure => $service_ensure,
|
||||
enable => $service_enable,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user