- From: Adam Jacob <adam@opscode.com>
- To: chef@lists.opscode.com
- Subject: [chef] Re: is there a smart way to tweak configurations file in chef? (or puppet, cfengine, or otherwise?)
- Date: Thu, 30 Jul 2009 21:17:15 -0700
On Thu, Jul 30, 2009 at 4:42 PM, Thomas
Hartman<thomashartman1@googlemail.com> wrote:
>
I have this scenario where I have a my.cnf ini file, and I want to
>
make sure it has a certain value in a certain section. (Can't just
>
append to the end of the file.)
>
>
I solved this using the perl file, attached. Obviously this isn't a
>
perfect solution though. If the value is already set, but set wrong,
>
it won't work.
>
>
The right way to do this would be to parse the ini file and do something
>
smart.
>
>
I am just wondering if this kind of tweak is a solved problem, in
>
chef, puppet, cfengine, or anywhere else.
>
>
Thanks in advance for any advice!
Like AJ pointed out, there are multiple ways to attack this. The
preferred method with Chef is to make a template of the file, and then
render the correct values. We let you be very clever to accomplish
this - for example, resources can be re-opened later, and more
variables added to the context the template is rendered in.
t = resources(:template => "my.cnf")
t.variables[:some_value] = 15
Is one example. This means you could iteratively build things up as you go.
Adam
--
Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com
Archive powered by MHonArc 2.6.16.