aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2010-12-15 03:11:52 +0000
committerMichael Scherer <misc@mageia.org>2010-12-15 03:11:52 +0000
commit6200ca643d340467412531b0419c80e7c52535db (patch)
treeb9ddd945204666a4a29e3d819c9a8a065a020764
parent5f145dd06ad0ad325e24d3d60e11b195ffeec641 (diff)
downloadpuppet-6200ca643d340467412531b0419c80e7c52535db.tar
puppet-6200ca643d340467412531b0419c80e7c52535db.tar.gz
puppet-6200ca643d340467412531b0419c80e7c52535db.tar.bz2
puppet-6200ca643d340467412531b0419c80e7c52535db.tar.xz
puppet-6200ca643d340467412531b0419c80e7c52535db.zip
add ssl support to django deployment class
-rw-r--r--modules/apache/manifests/init.pp10
-rw-r--r--modules/apache/templates/vhost_django_app.conf15
2 files changed, 23 insertions, 2 deletions
diff --git a/modules/apache/manifests/init.pp b/modules/apache/manifests/init.pp
index 09cba687..407e2ca2 100644
--- a/modules/apache/manifests/init.pp
+++ b/modules/apache/manifests/init.pp
@@ -116,9 +116,17 @@ class apache {
}
}
- define vhost_django_app($module = false, $module_path = false) {
+ define vhost_django_app($module = false, $module_path = false, $use_ssl = false) {
include apache::mod_wsgi
+ if $use_ssl {
+ include apache::mod_ssl
+ openssl::self_signed_cert{ "$name":
+ directory => "/etc/ssl/apache/",
+ before => File["$name.conf"],
+ }
+ }
+
# module is a ruby reserved keyword, cannot be used in templates
$django_module = $module
file { "$name.conf":
diff --git a/modules/apache/templates/vhost_django_app.conf b/modules/apache/templates/vhost_django_app.conf
index 9d64865f..1cc12458 100644
--- a/modules/apache/templates/vhost_django_app.conf
+++ b/modules/apache/templates/vhost_django_app.conf
@@ -1,4 +1,17 @@
-<VirtualHost *:80>
+<% if use_ssl then
+ port = 443
+else
+ port = 80
+end
+%>
+
+<VirtualHost *:<%= port %>>
+<% if use_ssl then %>
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/apache/<%= name %>.pem
+ SSLCertificateKeyFile /etc/ssl/apache/<%= name %>.pem
+<% end %>
+
ServerName <%= name %>
# Serve static content directly
DocumentRoot /dev/null