]> gitweb.fluxo.info Git - puppet-apache.git/commitdiff
Initial mpm support
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 8 Oct 2010 02:18:15 +0000 (23:18 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 8 Oct 2010 02:18:15 +0000 (23:18 -0300)
manifests/init.pp
templates/site.erb

index ae7acc05a261a0cfc2c0ff4aeacb1d781b49c10d..3eb5ee2aab19d20c4a0befcfa4ab77ff7d238f66 100644 (file)
@@ -60,6 +60,10 @@ class apache {
     ensure => installed,                                                                                                     
   }
 
+  package { "apache2-mpm-itk":
+    ensure => installed,                                                                                                     
+  }
+
   service { "apache":
     name       => "apache2",
     ensure     => running,
@@ -98,7 +102,9 @@ class apache {
               $redirect_match = false, $protocol = 'http', $aliases = false,
               $server_alias = false, $use = false, $ticket = false,
               $source = false, $template = 'apache/site.erb', $filename = '',
-              $manage_docroot = true, $owner = "root", $group = "root") {
+              $manage_docroot = false, $owner = '', $group = '',
+              $mpm = true, $password = '*', $comment = '', $sshkey = absent,
+              $groups = '', $shell = '/bin/false') {
 
     $vhost = $filename ? {
       ''      => "$title",
@@ -110,6 +116,32 @@ class apache {
       default => $base_domain,
     }
 
+    $user = $owner ? {
+      ''      => $title,
+      default => $owner,
+    }
+
+    $gid = $group ? {
+      ''      => $title,
+      default => $group,
+    }
+
+    if $mpm == true && $user != 'root' {
+      if !defined(User["$user"]) {
+        user::manage { "$user":
+          tag      => "virtual",
+          password => $password,
+          gid      => $gid,
+          comment  => $comment,
+          ticket   => $ticket,
+          groups   => $groups,
+          sshkey   => $sshkey,
+          shell    => $shell,
+          ensure   => $ensure,
+        }
+      }
+    }
+
     case $source {
       true: {
                file { "${apache2_sites}-available/$vhost":
@@ -156,8 +188,8 @@ class apache {
           if !defined(File["${docroot}"]) {
             file { "${docroot}":
               ensure  => present,
-              owner   => $owner,
-              group   => $group,
+              owner   => $user,
+              group   => $gid,
               mode    => 0755,
               recurse => false,
             }
@@ -167,6 +199,7 @@ class apache {
             exec { "check_docroot_${docroot}":
               command => "/bin/mkdir -p ${docroot}",
               unless  => "/bin/sh -c '[ -e ${docroot} ]'",
+              user    => root,
               before  => File["${docroot}"], 
             }
           }
index 4f5f3a1e393bbd171d61d65b5befd123d4ae84fd..80ad807ba2ac3c5fdcde98b5d3dbad79b2dcb79d 100644 (file)
 <% if use != false %><% use.each do |instance| -%>
    Use <%= instance %>
 <% end -%><% end -%>
+<% if mpm == true %>
+   <IfModule mpm_itk_module>
+     AssignUserId <%= user %> <%= gid %>
+   </IfModule>
+<% end %>   
 </VirtualHost>
 # end vhost for <%= title %>