- From: AJ Christensen <
>
- To: chef <
>
- Subject: [chef] Re: Augeas actually
- Date: Thu, 21 Feb 2013 10:01:18 +1300
render a template
On 20 February 2013 23:27, Sam Darwin
<
>
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.
>
:-)
>
>
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.