diff options
-rw-r--r-- | modules/apache/manifests/init.pp | 10 | ||||
-rw-r--r-- | modules/apache/templates/vhost_django_app.conf | 15 |
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 |