diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-02-21 16:31:23 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-02-21 16:31:23 -0300 |
commit | cb7db31fccae01b80150ed5bf09fe43e7308581e (patch) | |
tree | 18ef28e6708cb69adcf51e982a4ea5181d2648c4 /manifests | |
parent | 9110b7cd2cf19d673de859dcbd7731397bedca9d (diff) | |
download | puppet-supervisor-cb7db31fccae01b80150ed5bf09fe43e7308581e.tar.gz puppet-supervisor-cb7db31fccae01b80150ed5bf09fe43e7308581e.tar.bz2 |
Adding supervisor::app
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/app.pp | 33 |
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 + } + +} |