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


Chronological Thread 
  • From: Roger Rohrbach < >
  • To:
  • Subject: [chef] Re: Re: how to alter a recipe in the simplest, DRYest way?
  • Date: Sun, 25 Apr 2010 19:09:46 +0200

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.

§