Skip to content

Commit

Permalink
Allow users to manage the smartd service
Browse files Browse the repository at this point in the history
The smartd service resource has been wrapped in an if statement and
controlled by the $manage_service parameter, so that a user of the
module can choose manage the service externally.
  • Loading branch information
queeno committed Jun 12, 2015
1 parent 7ed901e commit 8e0f4bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
24 changes: 17 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
#
# defaults to: `running`
#
# [*manage_service*]
# `Bool`
#
# State whether or not this puppet module should manage the service.
#
# defaults to: `true`
#
# [*config_file*]
# `String`
#
Expand Down Expand Up @@ -101,6 +108,7 @@
$package_name = $smartd::params::package_name,
$service_name = $smartd::params::service_name,
$service_ensure = $smartd::params::service_ensure,
$manage_service = $smartd::params::manage_service,
$config_file = $smartd::params::config_file,
$devicescan = $smartd::params::devicescan,
$devicescan_options = $smartd::params::devicescan_options,
Expand Down Expand Up @@ -146,14 +154,16 @@
ensure => $pkg_ensure,
}

service { $service_name:
ensure => $svc_ensure,
enable => $svc_enable,
hasrestart => true,
hasstatus => true,
}
if $manage_service {
service { $service_name:
ensure => $svc_ensure,
enable => $svc_enable,
hasrestart => true,
hasstatus => true,
}

Package[$package_name] -> Service[$service_name]
Package[$package_name] -> Service[$service_name]
}

file { $config_file:
ensure => $file_ensure,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
class smartd::params {
$package_name = 'smartmontools'
$service_ensure = 'running'
$service_manage = true
$devicescan = true
$devicescan_options = undef
$devices = []
Expand Down

0 comments on commit 8e0f4bc

Please sign in to comment.