diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-08-15 17:39:07 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-08-15 17:39:07 -0300 |
commit | 009a3ad9745197d89643f02ed563d350ac3c13f0 (patch) | |
tree | bc3cc714fcd7e628a1d2922feed498740487384b | |
parent | 796b8264e559d267000a06ea13a64b987923f4eb (diff) | |
download | puppet-virtual-009a3ad9745197d89643f02ed563d350ac3c13f0.tar.gz puppet-virtual-009a3ad9745197d89643f02ed563d350ac3c13f0.tar.bz2 |
Adding vs_rlimit
-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}"], + } +} |