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