aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-02-21 16:31:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-02-21 16:31:23 -0300
commitcb7db31fccae01b80150ed5bf09fe43e7308581e (patch)
tree18ef28e6708cb69adcf51e982a4ea5181d2648c4 /manifests
parent9110b7cd2cf19d673de859dcbd7731397bedca9d (diff)
downloadpuppet-supervisor-cb7db31fccae01b80150ed5bf09fe43e7308581e.tar.gz
puppet-supervisor-cb7db31fccae01b80150ed5bf09fe43e7308581e.tar.bz2
Adding supervisor::app
Diffstat (limited to 'manifests')
-rw-r--r--manifests/app.pp33
1 files changed, 33 insertions, 0 deletions
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
+ }
+
+}