Skip to content

Commit

Permalink
Merge pull request #19 from DaveHewy/newrelic-infra-service-mods
Browse files Browse the repository at this point in the history
Add simple control mods for newrelic-infra service resource
  • Loading branch information
craigwatson authored Jul 26, 2018
2 parents 35daa25 + 70d7f55 commit c97f032
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions manifests/infra.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
# Whether to install the NewRelic OS repositories
# Default: Varies depending on OS (Boolean)
#
# [*manage_service*]
# Whether or not to manage the service as part of this module
# Default: true (Boolean)
#
# [*service_ensure*]
# State of the $service_name (newrelic-infra) service
# Default: running (String)
#
# [*service_name*]
# Name of the newrelic infra service
# Default: newrelic-infra (String)
#
# [*service_enable*]
# Whether to enable the service at boot
# Default: true (Boolean)
#
# === Authors
#
# Russell Whelan <[email protected]>
Expand All @@ -23,7 +39,11 @@
#
class newrelic::infra (
String $license_key,
Boolean $manage_repo = $::newrelic::params::manage_repo,
Boolean $manage_repo = $::newrelic::params::manage_repo,
Boolean $manage_service = true,
String $service_ensure = 'running',
String $service_name = 'newrelic-infra',
Boolean $service_enable = true
) inherits newrelic::params {

if $facts['os']['family'] == 'Windows' {
Expand All @@ -48,9 +68,12 @@
require => File['/etc/newrelic-infra.yml'],
}
service { 'newrelic-infra':
ensure => running,
require => Package['newrelic-infra']
if $manage_service {
service { $service_name:
ensure => $service_ensure,
name => $service_name,
enable => $service_enable,
require => Package['newrelic-infra']
}
}
}

0 comments on commit c97f032

Please sign in to comment.