Skip to content

Instantly share code, notes, and snippets.

@robyoung
Created March 7, 2014 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robyoung/9409658 to your computer and use it in GitHub Desktop.
Save robyoung/9409658 to your computer and use it in GitHub Desktop.
define govuk::app::service (
$ensure => 'present',
) {
$enable_service = str2bool(extlookup('govuk_app_enable_services', 'yes'))
if $ensure => 'absent' {
service { $title:
provider => 'base',
status => "ps -A | grep -v grep | grep -F '${title}'",
stop => "pkill '${title}'",
ensure => stopped,
}
} else {
service { $title:
provider => 'upstart',
}
if $enable_service {
Service[$title] {
ensure => running
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment