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 simple control mods for newrelic-infra service resource #19

Merged
merged 2 commits into from
Jul 26, 2018
Merged
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
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']
}
}

}