From 9102fa6429907124c8acc4a3b414e8bf34ceac91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kent=20Engstr=C3=B6m?= <kent@nsc.liu.se>
Date: Fri, 17 Oct 2014 14:40:19 +0200
Subject: [PATCH] New class apache::mod_wsgi for using Python WSGI
 applications.

Signed-off-by: Thomas Bellman <bellman@nsc.liu.se>
---
 manifests/mod_wsgi.pp | 47 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 manifests/mod_wsgi.pp

diff --git a/manifests/mod_wsgi.pp b/manifests/mod_wsgi.pp
new file mode 100644
index 0000000..6172ff9
--- /dev/null
+++ b/manifests/mod_wsgi.pp
@@ -0,0 +1,47 @@
+# Copyright (C) 2014 Kent Engström, Thomas Bellman.
+# Licensed under the GNU LGPL v3+; see the README file for more information.
+
+
+/*
+ * Install the Apache mod_wsgi module for running Python WSGI applications.
+ */
+class apache::mod_wsgi
+{
+    include apache
+
+    $default_options = {
+	# Default WSGISocketPrefix value broken on at least RHEL/Fedora
+	'WSGISocketPrefix' => 'run/wsgi',
+    }
+    package {
+	'mod_wsgi':
+	    ensure => installed,
+	    # We want conf.d to be cleaned up from whatever mod_wsgi puts there
+	    before => File[$apache::configdir];
+    }
+    apache::module::globalconfig {
+	'wsgi':
+	    loadmodule => 'wsgi_module modules/mod_wsgi.so',
+	    directives => [],
+	    defaultoptions => $default_options,
+	    options => { },
+	    require => Package['mod_wsgi'];
+    }
+}
+
+
+class apache::mod_wsgi::absent
+      inherits apache::mod_wsgi
+{
+    # Remove the configuration referencing the module before the actual
+    # module, in case the machine reboots in the middle.
+    Package['mod_wsgi'] {
+	ensure => absent,
+	before => [],
+    }
+    Apache::Module::Globalconfig['wsgi'] {
+	ensure => absent,
+	require => [],
+	before => Package['mod_wsgi'],
+    }
+}
-- 
GitLab