From: Silvio Rhatto Date: Thu, 21 Feb 2013 19:31:23 +0000 (-0300) Subject: Adding supervisor::app X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=cb7db31fccae01b80150ed5bf09fe43e7308581e;p=puppet-supervisor.git Adding supervisor::app --- diff --git a/manifests/app.pp b/manifests/app.pp new file mode 100644 index 0000000..aef36d2 --- /dev/null +++ b/manifests/app.pp @@ -0,0 +1,33 @@ +define supervisor::app ( + $command, + $directory, + $appname = $name, + $ensure = running, + $user = 'www-data', +) { + + $conf_title = "supervisor-${appname}" + $service_title = $conf_title + + file { $conf_title: + path => "/etc/supervisor/conf.d/${appname}.conf", + ensure => present, + content => template('supervisor/app.erb'), + require => Package['supervisor'], + notify => Service['supervisor'], + } + + service { $service_title: + ensure => $ensure, + path => ['/usr/bin'], + start => "supervisorctl start $appname", + restart => "supervisorctl restart $appname", + stop => "supervisorctl stop $appname", + status => "supervisorctl status | awk '/^${appname}[: ]/{print \$2}' | grep '^RUNNING$'", + subscribe => File[$conf_title], + hasrestart => false, + hasstatus => false, + provider => base + } + +}