[chef] Augeas actually


Chronological Thread 
  • From: Sam Darwin < >
  • To:
  • Subject: [chef] Augeas actually
  • Date: Wed, 20 Feb 2013 02:27:06 -0800 (PST)

Back to the topic of Augeas for this post, here are two quick solutions I am
trying out:

Option 1:

execute "sysctl.conf file" do
        command "augtool -s set /files/etc/sysctl.conf/vm.overcommit_memory 1"
        #returns [0,1]
end

This is looking like a really good way to modify files in-place!!!  I hope. 
:-)

Option 2:

Here is an example of the file edit utility:

ruby_block "edit etc ssh sshd_config" do
  block do
    rc = Chef::Util::FileEdit.new("/etc/ssh/sshd_config")
    rc.search_file_replace_line(
      /^Port 22$/,
      "Port 1234"
    )
    rc.write_file
  end
  notifies :restart, "service[ssh]"
end



Archive powered by MHonArc 2.6.16.

§