Advertisement
alexs77

Chef -> FileEdit -> replace with backreference #2

Aug 27th, 2015
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ruby_block "CIS: AutoFS start deaktivieren" do
  2.     block do
  3.         fe = Chef::Util::FileEdit.new("/etc/init/autofs.conf")
  4.         # "start on" auskommentieren
  5.         fe.search_file_replace(/^(start on.*)/,
  6.             "# removed because of CIS check:\n# \\1"
  7.             )
  8.  
  9.         # Datei schreiben
  10.         fe.write_file
  11.     end # of block do
  12. end # of ruby_block "CIS: AutoFS start deaktivieren" do
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement