Skip to content

Instantly share code, notes, and snippets.

@3h4x
Created June 14, 2014 08:09
Show Gist options
  • Save 3h4x/f0e240455e66907f5008 to your computer and use it in GitHub Desktop.
Save 3h4x/f0e240455e66907f5008 to your computer and use it in GitHub Desktop.
Replace matching line in puppet
define replace_matching_line($file, $match, $replace) {
exec { "/bin/sed ${file} -i.bak -e 's/${match}/${replace}/'":
onlyif => "/bin/grep -E '${match}' ${file}",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment