How do you extend / customize an existing cookbook?


#1

Hey guys,

The wiki was very vague about how to do it.
Right now I have my custom configuration files. The Nginx cookbook defines
the templates for these configuration files, so by default they are
installed.

  1. Do I just put my nginx.conf inside files/ directory?
    2, Do I edit the template files directly when I need to? Does this prevent
    me from getting update from the community? I suppose I will merge the
    changes?

  2. I need the directory /etc/nginx/sites-enabled contains my custom conf
    file. How do I tell the cookbook or chef to use files/custom.conf? Where
    do I put it?

  3. I am so new to chef cookbook. I only knew how to I specify
    default_attributes or override_attributes in my role files.

  4. If I add new template or definitions, or new files, doesn’t it mean I am
    writing my cookbook, rather than using the community’s one?

I am so unclear how to do these things. Please guide me. Thanks.

John


#2

Ohia!

This is the similar question that I’ve been try to fix for a while, but still couldn’t figured out the right way to do.

Not the same cookbook, but I’ve also posted the similar one at this thread. http://lists.opscode.com/sympa/arc/chef/2012-08/msg00130.html

+1 to this question.

Love to hear from the chef mentors!!


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, August 2, 2012 at 10:42 AM, John Wong wrote:

Hey guys,

The wiki was very vague about how to do it.
Right now I have my custom configuration files. The Nginx cookbook defines the templates for these configuration files, so by default they are installed.

  1. Do I just put my nginx.conf inside files/ directory?
    2, Do I edit the template files directly when I need to? Does this prevent me from getting update from the community? I suppose I will merge the changes?

  2. I need the directory /etc/nginx/sites-enabled contains my custom conf file. How do I tell the cookbook or chef to use files/custom.conf? Where do I put it?

  3. I am so new to chef cookbook. I only knew how to I specify default_attributes or override_attributes in my role files.

  4. If I add new template or definitions, or new files, doesn’t it mean I am writing my cookbook, rather than using the community’s one?

I am so unclear how to do these things. Please guide me. Thanks.

John