By thomas, Tue, 05/26/2009 - 09:22
append_if_no_such_line
define append_if_no_such_line($file, $line, $refreshonly = 'false') {
   exec { "/bin/echo '$line' >> '$file'":
      unless => "/bin/grep -Fxqe '$line' '$file'",
      path => "/bin",
      refreshonly => $refreshonly
   }
}
This is a generic function which looks for the argument $line using grep on $file. The appending is done with >> in the cmd argument for exec