[chef] Re: Re: Re: how to alter a recipe in the simplest, DRYest way?


Chronological Thread 
  • From: Gilles Devaux < >
  • To:
  • Subject: [chef] Re: Re: Re: how to alter a recipe in the simplest, DRYest way?
  • Date: Sat, 8 May 2010 10:51:50 -0700
  • 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:content-transfer-encoding; b=F+tFz3cnljFpe+SVEVEnBxnY0iuvTdBxicY4ijK9dmKXFcJizXN3Jjc0RAnv6iQ+zf GzrQuwGpVqlQyuNVNYKK5ByXm0rDYbhuGASqM77Ja3MSn7bJv3W0olRA9tgkIKifQvfB e1b/mXbBw+wl/dqiKm1yybn8G8otrFZXyR7Xo=

Always remember Chef is ruby.

I have a site-cookbook nginx cookbook with attribute file

include_attribute "nginx::nginx" #make sure of the load order
node[:nginx][:configure_flags] << "--with-http_stub_status_module" #add

--Gilles

On Sun, Apr 25, 2010 at 10:09 AM, Roger Rohrbach 
< >
 wrote:
> Joshua,
>
>  Thanks.  I'll try that.  But I humbly submit that Chef can do better.  DRY,
> DRY, DRY.  It'd be great to have syntax like:
>
>    append_attribute "nginx" => {"configure_flags" =>
>  "--with-http_realip_module"}
>
> (That's probably not what it'd look like, but you get the idea.)
>
> R.
>
>
>
>> Hi Roger!
>>
>> On Sun, Apr 25, 2010 at 9:41 AM, Roger Rohrbach 
>> < >
>> wrote:
>>>
>>> But when I install my recipes, execute chef-client on a node that
>>> has nginx::source in its run list, and watch it recompile Nginx, it uses
>>> the
>>> default value of configure_flags.
>>> My next stab is to try to use a Role.  So, I create roles/web-server.rb:
>>>    name "web-server"
>>>    description "Test role for configuring Web servers"
>>>    recipes "nginx::source"
>>>    override_attributes(
>>>      "nginx" => {
>>>        "configure_flags" => [
>>>            "--prefix=#{nginx[:install_path]}",
>>>            "--conf-path=#{nginx[:dir]}/nginx.conf",
>>>            "--with-http_ssl_module",
>>>            "--with-http_gzip_static_module",
>>>            "--with-http_realip_module"
>>>        ]
>>>      }
>>>    )
>>
>> A role is the best approach to this, but the role itself isn't aware
>> of the 'nginx' attribute when it is compiled into JSON. You should
>> hardset the --prefix with the install_path you want to use.
>>
>> "--prefix=/opt/nginx"
>>
>> Or similar.
>>
>> --
>> Opscode, Inc
>> Joshua Timberman, Senior Solutions Engineer
>> C: 720.878.4322 E: 
>
>
>



Archive powered by MHonArc 2.6.16.

§