Skip to content

Commit

Permalink
Merge pull request #552 from smitherz82/apache24_support
Browse files Browse the repository at this point in the history
Apache2.4 support
  • Loading branch information
blkperl committed Feb 6, 2014
2 parents b66c47a + c416bf4 commit cf7eff9
Show file tree
Hide file tree
Showing 31 changed files with 928 additions and 260 deletions.
53 changes: 48 additions & 5 deletions manifests/default_mods.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class apache::default_mods (
$all = true,
$mods = undef,
$all = true,
$mods = undef,
$apache_version = $apache::apache_version
) {
# These are modules required to run the default configuration.
# They are not configurable at this time, so we just include
Expand All @@ -27,10 +28,8 @@
include apache::mod::rewrite
apache::mod { 'actions': }
apache::mod { 'auth_digest': }
apache::mod { 'authn_alias': }
apache::mod { 'authn_anon': }
apache::mod { 'authn_dbm': }
apache::mod { 'authn_default': }
apache::mod { 'authz_dbm': }
apache::mod { 'authz_owner': }
apache::mod { 'expires': }
Expand All @@ -42,6 +41,18 @@
apache::mod { 'suexec': }
apache::mod { 'usertrack': }
apache::mod { 'version': }

if $apache_version >= 2.4 {
# Lets fork it
apache::mod { 'systemd': }

apache::mod { 'unixd': }
apache::mod { 'authn_core': }
}
else {
apache::mod { 'authn_alias': }
apache::mod { 'authn_default': }
}
}
'freebsd': {
include apache::mod::cache
Expand Down Expand Up @@ -101,11 +112,43 @@
include apache::mod::setenvif
apache::mod { 'auth_basic': }
apache::mod { 'authn_file': }
apache::mod { 'authz_default': }

if $apache_version >= 2.4 {
# authz_core is needed for 'Require' directive
apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
apache::mod { 'filter': }
} else {
apache::mod { 'authz_default': }
}

apache::mod { 'authz_groupfile': }
apache::mod { 'authz_user': }
apache::mod { 'env': }
} elsif $mods {
apache::default_mods::load { $mods: }

if $apache_version >= 2.4 {
# authz_core is needed for 'Require' directive
apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
apache::mod { 'filter': }
}
} else {
if $apache_version >= 2.4 {
# authz_core is needed for 'Require' directive
apache::mod { 'authz_core':
id => 'authz_core_module',
}

# filter is needed by mod_deflate
apache::mod { 'filter': }
}
}
}
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@
$logroot = $apache::params::logroot,
$log_level = $apache::params::log_level,
$ports_file = $apache::params::ports_file,
$apache_version = $apache::version::default,
$server_tokens = 'OS',
$server_signature = 'On',
$trace_enable = 'On',
$package_ensure = 'installed',
) inherits apache::params {

validate_bool($default_vhost)
validate_bool($default_ssl_vhost)
validate_bool($default_confd_files)
# true/false is sufficient for both ensure and enable
validate_bool($service_enable)

$valid_mpms_re = $::osfamily ? {
'FreeBSD' => '(event|itk|peruser|prefork|worker)',
default => '(itk|prefork|worker)'
$valid_mpms_re = $apache_version ? {
2.4 => '(event|itk|peruser|prefork|worker)',
default => '(event|itk|prefork|worker)'
}

if $mpm_module {
Expand Down
4 changes: 3 additions & 1 deletion manifests/mod/alias.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class apache::mod::alias {
class apache::mod::alias(
$apache_version = $apache::apache_version
) {
$icons_path = $::osfamily ? {
'debian' => '/usr/share/apache2/icons',
'redhat' => '/var/www/icons',
Expand Down
14 changes: 11 additions & 3 deletions manifests/mod/event.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$threadsperchild = '25',
$maxrequestsperchild = '0',
$serverlimit = '25',
$apache_version = $apache::apache_version,
) {
if defined(Class['apache::mod::itk']) {
fail('May not include both apache::mod::event and apache::mod::itk on the same node')
Expand Down Expand Up @@ -42,9 +43,16 @@
}

case $::osfamily {
'freebsd' : {
class { 'apache::package':
mpm_module => 'event'
'redhat': {
if $apache_version >= 2.4 {
apache::mpm{ 'event':
apache_version => $apache_version,
}
}
}
'debian','freebsd' : {
apache::mpm{ 'event':
apache_version => $apache_version,
}
}
default: {
Expand Down
5 changes: 4 additions & 1 deletion manifests/mod/info.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class apache::mod::info (
$allow_from = ['127.0.0.1','::1'],
$apache_version = $apache::apache_version,
){
apache::mod { 'info': }
# Template uses $allow_from
# Template uses
# $allow_from
# $apache_version
file { 'info.conf':
ensure => file,
path => "${apache::mod_dir}/info.conf",
Expand Down
19 changes: 4 additions & 15 deletions manifests/mod/itk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$serverlimit = '256',
$maxclients = '256',
$maxrequestsperchild = '4000',
$apache_version = $apache::apache_version,
) {
if defined(Class['apache::mod::event']) {
fail('May not include both apache::mod::itk and apache::mod::event on the same node')
Expand Down Expand Up @@ -40,21 +41,9 @@
}

case $::osfamily {
'debian' : {
file { "${apache::mod_enable_dir}/itk.conf":
ensure => link,
target => "${apache::mod_dir}/itk.conf",
require => Exec["mkdir ${apache::mod_enable_dir}"],
before => File[$apache::mod_enable_dir],
notify => Service['httpd'],
}
package { 'apache2-mpm-itk':
ensure => present,
}
}
'freebsd' : {
class { 'apache::package':
mpm_module => 'itk'
'debian', 'freebsd': {
apache::mpm{ 'itk':
apache_version => $apache_version,
}
}
default: {
Expand Down
38 changes: 17 additions & 21 deletions manifests/mod/prefork.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$serverlimit = '256',
$maxclients = '256',
$maxrequestsperchild = '4000',
$apache_version = $apache::apache_version,
) {
if defined(Class['apache::mod::event']) {
fail('May not include both apache::mod::prefork and apache::mod::event on the same node')
Expand Down Expand Up @@ -41,30 +42,25 @@

case $::osfamily {
'redhat': {
file_line { '/etc/sysconfig/httpd prefork enable':
ensure => present,
path => '/etc/sysconfig/httpd',
line => '#HTTPD=/usr/sbin/httpd.worker',
match => '#?HTTPD=/usr/sbin/httpd.worker',
require => Package['httpd'],
notify => Service['httpd'],
if $apache_version >= 2.4 {
apache::mpm{ 'prefork':
apache_version => $apache_version,
}
}
}
'debian': {
file { "${apache::mod_enable_dir}/prefork.conf":
ensure => link,
target => "${apache::mod_dir}/prefork.conf",
require => Exec["mkdir ${apache::mod_enable_dir}"],
before => File[$apache::mod_enable_dir],
notify => Service['httpd'],
}
package { 'apache2-mpm-prefork':
ensure => present,
else {
file_line { '/etc/sysconfig/httpd prefork enable':
ensure => present,
path => '/etc/sysconfig/httpd',
line => '#HTTPD=/usr/sbin/httpd.worker',
match => '#?HTTPD=/usr/sbin/httpd.worker',
require => Package['httpd'],
notify => Service['httpd'],
}
}
}
'freebsd' : {
class { 'apache::package':
mpm_module => 'prefork'
'debian', 'freebsd' : {
apache::mpm{ 'prefork':
apache_version => $apache_version,
}
}
default: {
Expand Down
34 changes: 29 additions & 5 deletions manifests/mod/ssl.pp
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
class apache::mod::ssl (
$ssl_compression = false,
$ssl_options = [ 'StdEnvVars' ],
$apache_version = $apache::apache_version,
) {
$session_cache = $::osfamily ? {
'debian' => '${APACHE_RUN_DIR}/ssl_scache(512000)',
'redhat' => '/var/cache/mod_ssl/scache(512000)',
'freebsd' => '/var/run/ssl_scache(512000)',
}
$ssl_mutex = $::osfamily ? {
'debian' => 'file:${APACHE_RUN_DIR}/ssl_mutex',
'redhat' => 'default',
'freebsd' => 'default',

case $::osfamily {
'debian': {
if $apache_version >= 2.4 and $::operatingsystem == 'Ubuntu' {
$ssl_mutex = 'default'
} else {
$ssl_mutex = 'file:${APACHE_RUN_DIR}/ssl_mutex'
}
}
'redhat': {
$ssl_mutex = 'default'
}
'freebsd': {
$ssl_mutex = 'default'
}
}

apache::mod { 'ssl': }

# Template uses $ssl_compression, $ssl_options, $session_cache, $ssl_mutex
if $apache_version >= 2.4 and $::operatingsystem == 'Ubuntu' {
apache::mod { 'socache_shmcb': }
}

# Template uses
#
# $ssl_compression
# $ssl_options
# $session_cache,
# $ssl_mutex
# $apache_version
#
file { 'ssl.conf':
ensure => file,
path => "${apache::mod_dir}/ssl.conf",
Expand Down
37 changes: 17 additions & 20 deletions manifests/mod/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$threadsperchild = '25',
$maxrequestsperchild = '0',
$serverlimit = '25',
$apache_version = $apache::apache_version,
) {
if defined(Class['apache::mod::event']) {
fail('May not include both apache::mod::worker and apache::mod::event on the same node')
Expand Down Expand Up @@ -43,29 +44,25 @@

case $::osfamily {
'redhat': {
file_line { '/etc/sysconfig/httpd worker enable':
ensure => present,
path => '/etc/sysconfig/httpd',
line => 'HTTPD=/usr/sbin/httpd.worker',
match => '#?HTTPD=/usr/sbin/httpd.worker',
notify => Service['httpd'],
if $apache_version >= 2.4 {
apache::mpm{ 'worker':
apache_version => $apache_version,
}
}
}
'debian': {
file { "${apache::mod_enable_dir}/worker.conf":
ensure => link,
target => "${apache::mod_dir}/worker.conf",
require => Exec["mkdir ${apache::mod_enable_dir}"],
before => File[$apache::mod_enable_dir],
notify => Service['httpd'],
}
package { 'apache2-mpm-worker':
ensure => present,
else {
file_line { '/etc/sysconfig/httpd worker enable':
ensure => present,
path => '/etc/sysconfig/httpd',
line => 'HTTPD=/usr/sbin/httpd.worker',
match => '#?HTTPD=/usr/sbin/httpd.worker',
require => Package['httpd'],
notify => Service['httpd'],
}
}
}
'freebsd' : {
class { 'apache::package':
mpm_module => 'worker'
'debian', 'freebsd': {
apache::mpm{ 'worker':
apache_version => $apache_version,
}
}
default: {
Expand Down
Loading

0 comments on commit cf7eff9

Please sign in to comment.