[chef] Re: usage of 'site-cookbooks' for template customizing


Chronological Thread 
  • From: Jay Feldblum < >
  • To:
  • Subject: [chef] Re: usage of 'site-cookbooks' for template customizing
  • Date: Tue, 3 Apr 2012 14:23:34 -0400

Christophe,

Overriding templates like that still works with chef-0.10, but it is deprecated and you should not use it for new work.

One technique I have used is to make a new cookbook named mysql-customizations with a single recipe as follows:

# site-cookbooks/mysql-customizations/metadata.rb
depends "mysql"

# site-cookbooks/mysql-customizations/recipes/default.rb
include_recipe "mysql"
resources(:template => "/etc/my.cnf").instance_exec do
  cookbook "mysql-customization"
end

# site-cookbooks/mysql-customizations/templates/default/my.cnf.erb
# custom custom custom
# your customized version of my.cnf.erb ...
# custom custom custom

And then, in your role/run-list, instead of using recipe[mysql], use recipe[mysql-customizations].

Cheers,
Jay Feldblum

On Tue, Apr 3, 2012 at 1:57 PM, < "> > wrote:
Hello,

We have used the following documentation section in order to customize
templates from the mysql and php cookbooks:
http://wiki.opscode.com/display/chef/Cookbooks#Cookbooks-CustomizingTemplatesandFiles

so we created a site-cookbooks folder, added it to the cookbook_path config for
knife, and created apache et mysql directory structure for the templates in
order to override my.cnf.erb for mysql and debian/php.ini.erb for php

but when running the command

knife cookbook upload -a

we got the following warning:

WARNING: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * *
WARNING: The cookbooks: mysql, php exist in multiple places in your
cookbook_path.
A composite version of these cookbooks has been compiled for uploading.

IMPORTANT: In a future version of Chef, this behavior will be removed and you
will no longer
be able to have the same version of a cookbook in multiple places in your
cookbook_path.
WARNING: The affected cookbooks are located:
mysql:
   /root/svnChef/trunk/chef-repo/cookbooks/mysql
   /root/svnChef/trunk/chef-repo/site-cookbooks/mysql
php:
   /root/svnChef/trunk/chef-repo/cookbooks/php
   /root/svnChef/trunk/chef-repo/site-cookbooks/php
WARNING: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * *

Could you let us know what we are doing wrong please ?

Thanks in advance for your answers.

Best regards,
Christophe




Archive powered by MHonArc 2.6.16.

§