Augeas actually


#1

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. :slight_smile:

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


#2

render a template

On 20 February 2013 23:27, Sam Darwin samuel.d.darwin@gmail.com wrote:

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. :slight_smile:

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