aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/limit.pp
blob: 71f355202780574a32feb32c40bd51aa99d78f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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}"],
  }
}