From: Peter Palfrader Date: Sun, 15 Sep 2019 17:32:17 +0000 (+0200) Subject: Replace apache_prefork role with an mpm class option for apache2 X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=2aa7a2ddccd274926e20eecebfd7dbf01f88eb03;p=mirror%2Fdsa-puppet.git Replace apache_prefork role with an mpm class option for apache2 --- diff --git a/hieradata/common.yaml b/hieradata/common.yaml index a7c84204d..dde9b7634 100644 --- a/hieradata/common.yaml +++ b/hieradata/common.yaml @@ -169,11 +169,6 @@ roles: bgp: - mirror-accumu.debian.org - mirror-skroutz.debian.org - apache_prefork: - # php needs this - - quantz.debian.org - - tchaikovsky.debian.org - - wuiet.debian.org postgresql_server: # postgresql instances not managed by puppet otherwise - bmdb1.debian.org diff --git a/hieradata/nodes/quantz.debian.org.yaml b/hieradata/nodes/quantz.debian.org.yaml index bc15a43fe..c391033a1 100644 --- a/hieradata/nodes/quantz.debian.org.yaml +++ b/hieradata/nodes/quantz.debian.org.yaml @@ -2,5 +2,6 @@ classes: - roles::qamaster +apache2::mpm: prefork # qa scripts sometimes needs a lot of memory. raise the limit to 300 MB apache2::rlimitmem: 314572800 diff --git a/hieradata/nodes/tchaikovsky.debian.org.yaml b/hieradata/nodes/tchaikovsky.debian.org.yaml new file mode 100644 index 000000000..d98e3f280 --- /dev/null +++ b/hieradata/nodes/tchaikovsky.debian.org.yaml @@ -0,0 +1,2 @@ +--- +apache2::mpm: prefork diff --git a/hieradata/nodes/wuiet.debian.org.yaml b/hieradata/nodes/wuiet.debian.org.yaml index b7a97dd54..39a073680 100644 --- a/hieradata/nodes/wuiet.debian.org.yaml +++ b/hieradata/nodes/wuiet.debian.org.yaml @@ -1,3 +1,6 @@ +--- classes: - roles::buildd_master - roles::static_source + +apache2::mpm: prefork diff --git a/modules/apache2/manifests/init.pp b/modules/apache2/manifests/init.pp index 1d9d23617..77f4c03c6 100644 --- a/modules/apache2/manifests/init.pp +++ b/modules/apache2/manifests/init.pp @@ -14,11 +14,14 @@ # @param rlimitmem A resource limit for memory usage. The default is usually fine. # @param public Whether this host's apache should be accessible from the public internet. # Sets appropriate firewall rules and optionally rate limits. +# @param mpm Which Multi-Processing Modules to use. Defaults to worker; +# the alternative is prefork. class apache2( Boolean $smaller_number_of_threads = false, Integer $rlimitnproc = 256, Integer $rlimitmem = 192 * 1024 * 1024, Boolean $public = true, + Enum['prefork','worker'] $mpm = 'worker', ) { include webserver @@ -103,13 +106,9 @@ class apache2( } apache2::module { 'mpm_event': ensure => absent } - if has_role('apache_prefork') { - apache2::module { 'mpm_worker': ensure => absent } - apache2::module { 'mpm_prefork': } - } else { - apache2::module { 'mpm_prefork': ensure => absent } - apache2::module { 'mpm_worker': } - } + apache2::module { 'mpm_worker' : ensure => ($mpm == 'worker' ) ? { true => 'present', default => absent } } + apache2::module { 'mpm_prefork': ensure => ($mpm == 'prefork') ? { true => 'present', default => absent } } + file { '/etc/apache2/mods-available/mpm_worker.conf': content => template('apache2/mpm_worker.erb'), }