You can use the FileEdit class in a ruby block:< "> > 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?
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.