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 execappend_if_no_such_line