diff options
author | Sergey Stankevich <sergey.stankevich@gmail.com> | 2012-09-09 18:36:30 -0400 |
---|---|---|
committer | Sergey Stankevich <sergey.stankevich@gmail.com> | 2012-09-09 18:36:30 -0400 |
commit | ed137893babebabdfdb5adf44d1a52272093ce8b (patch) | |
tree | f611108dc849fe8f4372aac981d7e242d59b957b /manifests/gunicorn.pp |
Initial import
Diffstat (limited to 'manifests/gunicorn.pp')
-rw-r--r-- | manifests/gunicorn.pp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp new file mode 100644 index 0000000..d328d75 --- /dev/null +++ b/manifests/gunicorn.pp @@ -0,0 +1,65 @@ +# == Define: python::gunicorn +# +# Manages Gunicorn virtual hosts. +# +# === Parameters +# +# [*ensure*] +# present|absent. Default: present +# +# [*virtualenv*] +# Run in virtualenv, specify directory. Default: disabled +# +# [*mode*] +# Gunicorn mode. +# wsgi|django. Default: wsgi +# +# [*dir*] +# Application directory. +# +# [*bind*] +# Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. +# Default: system-wide: unix:/tmp/gunicorn-$name.socket +# virtualenv: unix:${virtualenv}/${name}.socket +# +# [*environment*] +# Set ENVIRONMENT variable. Default: none +# +# === Examples +# +# python::gunicorn { 'vhost': +# ensure => present, +# virtualenv => '/var/www/project1', +# mode => 'wsgi', +# dir => '/var/www/project1/current', +# bind => 'unix:/tmp/gunicorn.socket', +# environment => 'prod', +# } +# +# === Authors +# +# Sergey Stankevich +# +define python::gunicorn ( + $ensure = present, + $virtualenv = false, + $mode = 'wsgi', + $dir = false, + $bind = false, + $environment = false +) { + + # Parameter validation + if ! $dir { + fail('python::gunicorn: dir parameter must not be empty') + } + + file { "/etc/gunicorn.d/${name}": + ensure => $ensure, + mode => '0644', + owner => 'root', + group => 'root', + content => template('python/gunicorn.erb'), + } + +} |