Advertisement
alexs77

Chef -> FileEdit -> replace_line with backreference #1

Aug 27th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.41 KB | None | 0 0
  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_line(/^(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