diff options
Diffstat (limited to 'manifests/vserver/flags.pp')
-rw-r--r-- | manifests/vserver/flags.pp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/manifests/vserver/flags.pp b/manifests/vserver/flags.pp new file mode 100644 index 0000000..59c1b43 --- /dev/null +++ b/manifests/vserver/flags.pp @@ -0,0 +1,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}", + } + } + } +} |