Skip to content

Instantly share code, notes, and snippets.

@fujin
Created January 31, 2012 21:49
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save fujin/1713157 to your computer and use it in GitHub Desktop.
Save fujin/1713157 to your computer and use it in GitHub Desktop.
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end
include_recipe "whatever_cookbook::foo"
begin
t = resources(:template => "/tmp/foo.rb")
t.source "bonkers.rb.erb"
t.cookbook "definitely_not_banana"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find template /tmp/foo.rb to modify"
end
@randoum
Copy link

randoum commented Mar 31, 2013

Excellent, thanks

@code-later
Copy link

Thanks for this. You saved my day!

@tolland
Copy link

tolland commented May 3, 2014

Thanks! did the trick.

@Liyaqat-M
Copy link

How do you send variables to the overridden template?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment