Revision
621
Author
misc
Date
2010-12-15 04:11:52 +0100 (Wed, 15 Dec 2010)

Log Message

add ssl support to django deployment class

Modified Paths

Modified: puppet/modules/apache/manifests/init.pp
===================================================================
--- puppet/modules/apache/manifests/init.pp	2010-12-15 01:39:37 UTC (rev 620)
+++ puppet/modules/apache/manifests/init.pp	2010-12-15 03:11:52 UTC (rev 621)
@@ -116,9 +116,17 @@
         }
     }
 
-    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":

Modified: puppet/modules/apache/templates/vhost_django_app.conf
===================================================================
--- puppet/modules/apache/templates/vhost_django_app.conf	2010-12-15 01:39:37 UTC (rev 620)
+++ puppet/modules/apache/templates/vhost_django_app.conf	2010-12-15 03:11:52 UTC (rev 621)
@@ -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