[chef] Re: Re: 'parameterize' recipies


Chronological Thread 
  • From: erich oliphant < >
  • To:
  • Subject: [chef] Re: Re: 'parameterize' recipies
  • Date: Thu, 8 Apr 2010 14:24:30 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=JFkMhfeuece2a8LJYOzFHJnZaADfBcCtgiHO8AWzwXMXMMAY5sdy5A3nbnyQ0vWQDX 8zI+zgoN6L5cof1lHXDOYVKvrE1vfxIKC9cf2PVHwb0d6COip+CnKQM01gNODZnx/WkY S59ATaQDR/wQaKBz6nYviTwbWYsh3QRD5lxpg=

Ok cool, so basically I'd use a script or something to update the attribute then just rerun chef-client ?

On Thu, Apr 8, 2010 at 1:06 PM, Michael Hale < "> > wrote:
Yes Chef is idempotent given the same set of cookbooks, and
attributes. You can make a cookbook do something different by changing
the attributes.

For example take a look at the apache cookbook default recipe line 67:
http://github.com/opscode/cookbooks/blob/master/apache2/recipes/default.rb#L67

You'll notice that node[:apache][:dir] is evaluated to determine the
directory where sites-available, sites-enabled, mods-available,
mods-enabled will be created. If you wanted to you could change the
value of the apache[:dir] attribute to say /home/erich/apache2, which
would end up creating:

/home/erich/apache2/sites-available
/home/erich/apache2/sites-enabled
/home/erich/apache2/mods-available
/home/erich/apache2/mods-enabled

On Thu, Apr 8, 2010 at 12:47 PM, erich oliphant
< "> > wrote:
> Hi,
> I am new to chef, have been through the examples,etc and have quick
> question.  Running a recipe seems to be 'idempotent', you run it once it
> does it's thing, if you rerun and the 'target' has not changed it won't do
> anything.  I am trying to understand how I can use chef for dynamic
> provisioning.  For instance, I have an apache virtual server template, but I
> want to be able to run the same recipe but have it create a virtual host at
> 'foo.domain.com', whose DocumentRoot is '/vhosts/foo', etc based on somehow
> passing in 'foo' to the cookbook.
>
> --
> Erich Oliphant
>
> "There are, in fact, two things, science and opinion, the former begets
> knowledge, the latter ignorance"
> -- Hippocrates of Cos
>



--
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets knowledge, the latter ignorance"
-- Hippocrates of Cos



Archive powered by MHonArc 2.6.16.

§