puppetlabs-apache and foreman: non-default values for mpm_worker

asked 2015-12-01 03:18:07 -0600

olteschn gravatar image

Hi there,

we have the following environment:

Red Hat Enterprise Linux 6.7 Kernel: 2.6.32-573.7.1.el6.x8664 Apache-Webserver-Version: httpd-2.2.15-47.el67.x86_64 Puppet-Version: 3.8.4-1.el6.noarch Foreman-Version: 1.9.3 (as ENC for our Puppetmaster) puppetlabs/apache: 1.7.0

We do not use the default_mods, that the class apache delivers.

I try to specify custom values for apache::mod::worker, for example for parameter "startservers" value "3". In the documentation it says:

You must set this to 'false' to explicitly declare the following classes with custom parameters:

apache::mod::event
apache::mod::itk
apache::mod::peruser
apache::mod::prefork
apache::mod::worker

https://forge.puppetlabs.com/puppetlabs/apache#mpm_module

Sadly setting to false did not work for me, see ticket: https://tickets.puppetlabs.com/browse...

When I leave the parameter mpm_module of class apache at string "worker", I get the following exception, when trying to define custom values for parameters of apache::mod::worker:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Apache::Mod::Worker] is already declared; cannot redeclare at /etc/puppet/environments/production/modules/apache/manifests/init.pp:349 on node xxx.xx

Now when I leave the parameter "mpm_module" in class apache empty and define custom values for paramters of apache::mod::worker I get the following exceptions on my puppet node:

Error: Failed to apply catalog: Could not find dependency Exec[mkdir ] for File[/worker.conf] at /etc/puppet/environments/production/modules/apache/manifests/mod/worker.pp:101

So now, I added the module worker to our overwritten defaultmods: ["alias","authbasic","authn_file",many others...,"worker"] Now I can overwrite the default values from apache::mod::worker and I don´t get any exception. The worker.conf is created under /etc/httpd/conf.d Directory. But there is no load-File for this module.

When I look at the code for this module, this seems to be the right behaviour for redhat - is this correct?

case $::osfamily {
'debian': {
  file { "${::apache::mod_enable_dir}/${mpm}.conf":
    ensure  => link,
    target  => "${::apache::mod_dir}/${mpm}.conf",
    require => Exec["mkdir ${::apache::mod_enable_dir}"],
    before  => File[$::apache::mod_enable_dir],
    notify  => Class['apache::service'],
  }

  if versioncmp($apache_version, '2.4') >= 0 {
    file { "${::apache::mod_enable_dir}/${mpm}.load":
      ensure  => link,
      target  => "${::apache::mod_dir}/${mpm}.load",
      require => Exec["mkdir ${::apache::mod_enable_dir}"],
      before  => File[$::apache::mod_enable_dir],
      notify  => Class['apache::service'],
    }

    if $mpm == 'itk' {
        file { "${lib_path}/mod_mpm_itk.so":
          ensure => link,
          target => "${lib_path}/mpm_itk.so"
        }
    }
  }

  if versioncmp($apache_version, '2.4') < 0 {
    package { "apache2-mpm-${mpm}":
      ensure => present,
    }
  }
}
'freebsd': {
  class { '::apache::package':
    mpm_module => $mpm
  }
}
'redhat': {
  # so we don't fail
}

Thanks and kind regards, Oliver

edit retag flag offensive close merge delete