summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/init.pp39
-rw-r--r--templates/site.erb5
2 files changed, 41 insertions, 3 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index ae7acc0..3eb5ee2 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -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}"],
}
}
diff --git a/templates/site.erb b/templates/site.erb
index 4f5f3a1..80ad807 100644
--- a/templates/site.erb
+++ b/templates/site.erb
@@ -11,5 +11,10 @@
<% 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 %>