aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/rlimit.pp
blob: 0218359e4d7d069c095c8360885ef9c685421e0d (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
define virtual::vserver::rlimit(
  $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}"],
  }
}