aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/limit.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/vserver/limit.pp')
-rw-r--r--manifests/vserver/limit.pp34
1 files changed, 34 insertions, 0 deletions
diff --git a/manifests/vserver/limit.pp b/manifests/vserver/limit.pp
new file mode 100644
index 0000000..71f3552
--- /dev/null
+++ b/manifests/vserver/limit.pp
@@ -0,0 +1,34 @@
+define virtual::vserver::limit($vserver, $limit, $soft = '', $hard = '', $min = '', $ensure = present) {
+ file { "/etc/vservers/${vserver}/rlimits/$limit.soft":
+ mode => 0644, owner => root, group => root,
+ content => "$soft\n",
+ ensure => $soft ? {
+ '' => absent,
+ default => $ensure,
+ },
+ 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",
+ ensure => $hard ? {
+ '' => absent,
+ default => $ensure,
+ },
+ 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",
+ ensure => $min? {
+ '' => absent,
+ default => $ensure,
+ },
+ require => File["/etc/vservers/${vserver}/rlimits"],
+ notify => Exec["vs_restart_${vserver}"],
+ }
+}