aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/vserver.pp80
1 files changed, 53 insertions, 27 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp
index b7d2c98..55e6841 100644
--- a/manifests/vserver.pp
+++ b/manifests/vserver.pp
@@ -116,7 +116,9 @@ class vserver::host {
}
define vs_create($in_domain, $context, $legacy = false, $distro = 'etch',
- $debootstrap_mirror = 'http://ftp.debian.org/debian', $hostname = false, $interface = false) {
+ $debootstrap_mirror = 'http://ftp.debian.org/debian',
+ $hostname = false, $interface = false,
+ $memory_limit = false) {
$vs_name = $legacy ? { true => $name, false => $in_domain ? { '' => $name, default => "${name}.${in_domain}" } }
$vs_hostname = $hostname ? { false => 'none', default => $hostname }
$vs_interface = $interface ? { false => 'none', default => $interface }
@@ -131,7 +133,7 @@ define vs_create($in_domain, $context, $legacy = false, $distro = 'etch',
}
}
false: {
- exec { "/usr/local/bin/build_vserver \"${vs_name}\" ${context} ${distro} ${debootstrap_mirror} ${vs_hostname} ${vs_interface}":
+ exec { "/usr/local/bin/build_vserver \"${vs_name}\" ${context} ${distro} ${debootstrap_mirror} ${vs_hostname} ${vs_interface} ${memory_limit}":
creates => "/etc/vservers/${vs_name}",
require => File["/usr/local/bin/build_vserver"],
alias => "vs_create_${vs_name}",
@@ -139,11 +141,31 @@ define vs_create($in_domain, $context, $legacy = false, $distro = 'etch',
}
}
}
+
+ case $memory_limit {
+ false: { }
+ default: {
+ file { "/etc/vservers/${vs_name}/rlimits":
+ ensure => directory,
+ mode => 0755, owner => root, group => root,
+ }
+ file { "/etc/vservers/${vs_name}/rlimits/rss.hard":
+ mode => 0644, owner => root, group => root,
+ content => template("virtual/rss.hard.erb"),
+ require => File['/etc/vservers/${vs_name}/rlimits'],
+ }
+ file { "/etc/vservers/${vs_name}/rlimits/rss.soft":
+ mode => 0644, owner => root, group => root,
+ content => template("virtual/rss.soft.erb"),
+ require => File['/etc/vservers/${vs_name}/rlimits'],
+ }
+ }
+ }
}
# ensure: present, stopped, running
define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false, $distro = 'etch',
- $hostname = false, $interface = false) {
+ $hostname = false, $interface = false, $memory_limit = false) {
case $in_domain { '': {}
default: { err("${fqdn}: vserver ${name} uses deprecated \$in_domain" ) }
}
@@ -160,42 +182,46 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false,
case $ensure {
present: {
vs_create{ $name:
- in_domain => $in_domain,
- context => $context,
- legacy => $legacy,
- distro => $distro,
- hostname => $hostname,
- interface => $interface,
+ in_domain => $in_domain,
+ context => $context,
+ legacy => $legacy,
+ distro => $distro,
+ hostname => $hostname,
+ interface => $interface,
+ memory_limit => $memory_limit,
}
}
running: {
vs_create{ $name:
- in_domain => $in_domain,
- context => $context,
- legacy => $legacy,
- distro => $distro,
- hostname => $hostname,
- interface => $interface,
+ in_domain => $in_domain,
+ context => $context,
+ legacy => $legacy,
+ distro => $distro,
+ hostname => $hostname,
+ interface => $interface,
+ memory_limit => $memory_limit,
}
}
stopped: {
vs_create{ $name:
- in_domain => $in_domain,
- context => $context,
- legacy => $legacy,
- distro => $distro,
- hostname => $hostname,
- interface => $interface,
+ in_domain => $in_domain,
+ context => $context,
+ legacy => $legacy,
+ distro => $distro,
+ hostname => $hostname,
+ interface => $interface,
+ memory_limit => $memory_limit,
}
}
delete: {
vs_create{ $name:
- in_domain => $in_domain,
- context => $context,
- legacy => $legacy,
- distro => $distro,
- hostname => $hostname,
- interface => $interface,
+ in_domain => $in_domain,
+ context => $context,
+ legacy => $legacy,
+ distro => $distro,
+ hostname => $hostname,
+ interface => $interface,
+ memory_limit => $memory_limit,
}
}
default: {