diff options
Diffstat (limited to 'manifests/vserver/cflags.pp')
-rw-r--r-- | manifests/vserver/cflags.pp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/manifests/vserver/cflags.pp b/manifests/vserver/cflags.pp new file mode 100644 index 0000000..c6df50f --- /dev/null +++ b/manifests/vserver/cflags.pp @@ -0,0 +1,35 @@ +define virtual::vserver::cflags($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["vserver_instance_${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["vserver_instance_${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["vserver_instance_${vserver}"], + alias => "vattribute-${vserver}-${flag}", + } + } + } +} + |