diff options
-rw-r--r-- | manifests/config.pp | 23 | ||||
-rw-r--r-- | manifests/init.pp | 41 | ||||
-rw-r--r-- | manifests/site.pp | 1 | ||||
-rw-r--r-- | manifests/site/user.pp | 4 |
4 files changed, 57 insertions, 12 deletions
diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 0000000..72d5a48 --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,23 @@ +define apache::config( + $content = '', + $source = '', + $ensure = 'present', +) { + $conf_d = $::apache::conf_d + + file { "${conf_d}/${name}.conf": + mode => '0644', + owner => 'root', + group => 'root', + ensure => $ensure, + content => $content ? { + '' => undef, + default => "${content}\n", + }, + source => $source ? { + '' => undef, + default => $source, + }, + notify => Service['apache2'], + } +} diff --git a/manifests/init.pp b/manifests/init.pp index cbd8007..91b20b3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -42,6 +42,7 @@ class apache( $https_port = '443', $default_user = 'www-data', $default_group = 'www-data', + $mpm = 'itk', ) { include ssl @@ -107,18 +108,40 @@ class apache( require => Package["apache"], } - # Conflicts with mpm_itk - apache::module { "mpm_event": - ensure => absent, - require => Package['apache'], - } + # MPM selection + # There could be only one apache::module { "mpm_itk": - ensure => $::lsbdistcodename ? { - wheezy => absent, - default => present, + ensure => $mpm ? { + 'itk' => present, + default => absent, + }, + require => Package['apache', 'libapache2-mpm-itk'], + } + + apache::module { "mpm_prefork": + ensure => $mpm ? { + 'itk' => present, + 'prefork' => present, + default => absent, + }, + require => [ Package['apache'], Apache::Module['mpm_itk'] ], + } + + apache::module { "mpm_worker": + ensure => $mpm ? { + 'worker' => present, + default => absent, + }, + require => [ Package['apache'], Apache::Module['mpm_prefork'] ], + } + + apache::module { "mpm_event": + ensure => $mpm ? { + 'event' => present, + default => absent, }, - require => [ Package['apache', 'libapache2-mpm-itk'], Apache::Module['mpm_event'] ], + require => [ Package['apache'], Apache::Module['mpm_worker'] ], } # disable compression diff --git a/manifests/site.pp b/manifests/site.pp index 24dba9b..63c97c8 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -63,7 +63,6 @@ define apache::site( apache::site::user { $name: ensure => $ensure, - mpm => $mpm, manage_user => $manage_user, user => $user, password => $password, diff --git a/manifests/site/user.pp b/manifests/site/user.pp index ec5866c..b1fe071 100644 --- a/manifests/site/user.pp +++ b/manifests/site/user.pp @@ -1,6 +1,5 @@ define apache::site::user( $ensure = present, - $mpm = true, $manage_user = true, $user = $name, $gid = $name, @@ -12,7 +11,8 @@ define apache::site::user( $groups = '', $shell = '/bin/false', ){ - if $mpm == true and $manage_user == true and $user != 'root' { + #if $mpm == true and $manage_user == true and $user != 'root' { + if $manage_user == true and $user != 'root' { if $ensure == present { if !defined(Group[$gid]) { group { "$gid": |