Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbz/6242178 to your computer and use it in GitHub Desktop.
Save jbz/6242178 to your computer and use it in GitHub Desktop.
line = '127.0.0.1 gateway.internal gateway'
file = Chef::Util::FileEdit.new('/etc/hosts')
file.insert_line_if_no_match(/#{line}/, line)
file.write_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment