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}", } } } }