diff options
-rw-r--r-- | manifests/vserver.pp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp index efee9e1..cd420c0 100644 --- a/manifests/vserver.pp +++ b/manifests/vserver.pp @@ -157,6 +157,12 @@ define vs_create($in_domain, $context, $legacy = false, $distro = 'squeeze', } } + file { "/etc/vservers/${vs_name}/rlimits": + ensure => directory, + mode => 0755, owner => root, group => root, + require => Exec["vs_create_${vs_name}"], + } + case $memory_limit { false: { file { "/etc/vservers/${vs_name}/rlimits/rss.hard": @@ -176,12 +182,6 @@ define vs_create($in_domain, $context, $legacy = false, $distro = 'squeeze', } } default: { - file { "/etc/vservers/${vs_name}/rlimits": - ensure => directory, - mode => 0755, owner => root, group => root, - require => Exec["vs_create_${vs_name}"], - } - file { "/etc/vservers/${vs_name}/rlimits/rss.hard": mode => 0644, owner => root, group => root, content => template("virtual/rss.hard.erb"), @@ -636,3 +636,26 @@ define vs_cflags($vserver, $flag, $ensure = present) { } } } + +define vs_rlimit($vserver, $limit, $soft = '', $hard = '', $min = '', $ensure = present) { + file { "/etc/vservers/${vserver}/rlimits/$limit.soft": + mode => 0644, owner => root, group => root, + content => "$soft\n", + require => File["/etc/vservers/${vserver}/rlimits"], + notify => Exec["vs_restart_${vserver}"], + } + + file { "/etc/vservers/${vserver}/rlimits/$limit.hard": + mode => 0644, owner => root, group => root, + content => "$hard\n", + require => File["/etc/vservers/${vserver}/rlimits"], + notify => Exec["vs_restart_${vserver}"], + } + + file { "/etc/vservers/${vserver}/rlimits/$limit.min": + mode => 0644, owner => root, group => root, + content => "$min\n", + require => File["/etc/vservers/${vserver}/rlimits"], + notify => Exec["vs_restart_${vserver}"], + } +} |