Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/148542

Change subject: apache: add apache::mpm
......................................................................

apache: add apache::mpm

Adds a resource for specifying an apache2 mpm version.
For now, use prefork mpm everywhere.

Change-Id: Ic952146b5eecb1d2e163e91fc08232202c728249
---
M modules/apache/manifests/init.pp
A modules/apache/manifests/mpm.pp
2 files changed, 45 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/42/148542/1

diff --git a/modules/apache/manifests/init.pp b/modules/apache/manifests/init.pp
index 73e6954..59a15fe 100644
--- a/modules/apache/manifests/init.pp
+++ b/modules/apache/manifests/init.pp
@@ -22,7 +22,7 @@
     include apache::mod::filter         # enables AddOutputFilterByType in 2.4
     include apache::mod::version        # enables <IfVersion> config guards
 
-    package { [ 'apache2', 'apache2-mpm-prefork' ]:
+    package { 'apache2':
         ensure => present,
     }
 
@@ -76,6 +76,8 @@
         }
     }
 
+    apache::mpm { 'prefork': }
+
     apache::conf { 'defaults':
         source   => 'puppet:///modules/apache/defaults.conf',
         priority => 0,
diff --git a/modules/apache/manifests/mpm.pp b/modules/apache/manifests/mpm.pp
new file mode 100644
index 0000000..82df3e1
--- /dev/null
+++ b/modules/apache/manifests/mpm.pp
@@ -0,0 +1,42 @@
+# == Define: apache::mpm
+#
+# This resource configures an Apache Multi-Processing Module (MPM).
+#
+# === Parameters
+#
+# [*mpm*]
+#   Name of the MPM. Defaults to resource title.
+#
+define apache::mpm( $mpm = $title ) {
+    include ::apache
+
+    if $mpm !~ /^(prefork|worker|event)$/ {
+        fail("mpm must be 'prefork', 'worker', or 'event' (got: ${mpm})")
+    }
+
+    package { "apache2-mpm-${mpm}":
+        ensure => present,
+    }
+
+    if $mpm != 'prefork' {
+        # Threaded MPMs are not compatible with the PHP module.
+        apache::mod_conf { 'php5':
+            ensure => absent,
+            before => Exec['select_apache2_mpm'],
+        }
+    }
+
+    file { "/etc/apache2/mods-available/mpm_${mpm}.load":
+        ensure  => file,
+        require => Package['apache2', "apache2-mpm-${mpm}"],
+    }
+
+    exec { 'select_apache2_mpm':
+        command => "/usr/sbin/a2dismod -q `/usr/bin/basename mpm_*.load 
.load`; /usr/sbin/a2enmod mpm_${mpm}",
+        creates => "/etc/apache2/mods-enabled/mpm_${mpm}.load",
+        require => File["/etc/apache2/mods-available/mpm_${mpm}.load"],
+        notify  => Service['apache2'],
+    }
+
+    Package["apache2-mpm-${mpm}"] -> Apache::Mod_conf <| |>
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/148542
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic952146b5eecb1d2e163e91fc08232202c728249
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to