[chef] Re: Re: Any equivalent of "puppet augeas" in Chef?


Chronological Thread 
  • From: Jorge Bianquetti < >
  • To:
  • Subject: [chef] Re: Re: Any equivalent of "puppet augeas" in Chef?
  • Date: Mon, 16 Sep 2013 10:21:28 +0200

Recently discussed on this list:  http://community.opscode.com/cookbooks/line




2013/9/16 Jeppe Nejsum Madsen < " target="_blank"> >
< "> > 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.

§