Skip to content

Instantly share code, notes, and snippets.

@clifferson
Forked from thommay/noit.rb
Created August 17, 2012 04:51
Show Gist options
  • Save clifferson/3376042 to your computer and use it in GitHub Desktop.
Save clifferson/3376042 to your computer and use it in GitHub Desktop.
Modify a file line inline in chef
ruby_block "configure #{p} module" do
block do
require 'chef/util/file_edit'
nc = Chef::Util::FileEdit.new("/etc/reconnoiter/noit.conf")
nc.insert_line_after_match(/lua.*noit.module.smtp/, "<module loader=\"lua\" name=\"#{p}\" object=\"noit.module.#{p}\"/>")
nc.write_file
Chef::Log.info "Inserted module config for #{p}"
end
http://tickets.opscode.com/browse/CHEF-78?focusedCommentId=10781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-10781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment