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


Chronological Thread 
  • From: Guilhem Lettron < >
  • To:
  • Subject: [chef] Re: Re: Re: Any equivalent of "puppet augeas" in Chef?
  • Date: Mon, 16 Sep 2013 11:04:12 +0200

If you want to edit a configuration file, you can try (for test) this one too (from me):

I only manage INI file, but anyone can had support for YAML ...
You can change/add properties or rewrite a file from an Hash.

I don't use augeas right now... but I will really enjoy any contribution in this way.

Guilhem Lettron


On Mon, Sep 16, 2013 at 10:21 AM, Jorge Bianquetti < " target="_blank"> > wrote:
Recently discussed on this list:  http://community.opscode.com/cookbooks/line




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

§