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::flag($vserver, $flag, $ensure = present) {
if ! defined(File["/etc/vservers/${vserver}/cflags"]) {
file { "/etc/vservers/${vserver}/cflags":
ensure => present,
}
}
line {"vs_cflags-${vserver}-${flag}":
ensure => $ensure,
file => "/etc/vservers/${vserver}/cflags",
line => "${flag}",
require => Exec["vs_create_${vserver}"],
notify => Exec["vattribute-${vserver}-${flag}"],
}
case $ensure {
present: {
exec { "/usr/sbin/vattribute-${vserver}-${flag}":
command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ${flag}",
refreshonly => true,
require => Exec["vs_create_${vserver}"],
alias => "vattribute-${vserver}-${flag}",
}
}
default: {
exec { "/usr/sbin/vattribute-${vserver}-${flag}":
command => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ~${flag}",
refreshonly => true,
require => Exec["vs_create_${vserver}"],
alias => "vattribute-${vserver}-${flag}",
}
}
}
}
|