- From: Jeppe Nejsum Madsen <
>
- To:
- Subject: [chef] Re: Any equivalent of "puppet augeas" in Chef?
- Date: Mon, 16 Sep 2013 10:01:55 +0200
<
>
writes:
>
Hi there,
>
>
I need to do in-place file editing of config files using Chef. For now, i
>
could
>
see that we can append data to the config files using the "bash" resource.
>
But,
>
i need to change specific variables in config files using Chef.
>
>
I could see that there's a handy tool called augeas in puppet that clearly
>
performs the above requirement. But, i couldn't come up with anything in
>
Chef.
>
>
So, is there any way this could be done in Chef?
You can use the FileEdit class in a ruby block:
ruby_block "Update vars" do
block do
rc = Chef::Util::FileEdit.new(some_path)
rc.search_file_replace(...)
rc.write_file
end
action :create
end
/Jeppe
Archive powered by MHonArc 2.6.16.