How to override the source erb template from another custom cookbook?


#1

Hi Chefellas!

In the chef-client cookbook, following is the template recource:

template “#{node[“chef_client”][“conf_dir”]}/client.rb” do
source "client.rb.erb"
owner "root"
group root_group
mode 0644
variables :chef_node_name => chef_node_name
notifies :create, "ruby_block[reload_client_config]"
end

I want to replace/override the contents of the client.rb.erb template that is
inside the templates/default/client.rb.erb, with my other cookbook that will
run later.

Duplicating and doing the same thing my own cookbook/recipes with templates is
doable. But is this the a good practice is such case?


#2

On Wed, Jul 4, 2012 at 1:11 PM, Millisami millisami@gmail.com wrote:

I want to replace/override the contents of the client.rb.erb template that is
inside the templates/default/client.rb.erb, with my other cookbook that will
run later.

Duplicating and doing the same thing my own cookbook/recipes with templates is
doable. But is this the a good practice is such case?

I try to always avoid editing the Opscode/community cookbooks. Suggest
following the apache2/wordpress example here:

http://wiki.opscode.com/display/chef/Templates


Andy Gale
http://andy-gale.com
http://twitter.com/andygale