-
-
Save paulschwarz/3801910 to your computer and use it in GitHub Desktop.
template override between cookbooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template "/tmp/foo.rb" | |
source "foo.rb.erb" | |
cookbook "banana" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template "/tmp/foo.rb" | |
source "foo.rb.erb" | |
cookbook "banana" | |
end | |
template "#{node['nginx']['dir']}/sites-available/default" do | |
source "default-site.erb" | |
owner "root" | |
group "root" | |
mode 0644 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe "nginx" | |
begin | |
t = resources("template[#{node['nginx']['dir']}/sites-available/default]") | |
t.source "/home/vagrant/myapp/cookbooks/project/templates/default-site.erb" | |
t.cookbook "project" | |
rescue Chef::Exceptions::ResourceNotFound | |
Chef::Log.warn "could not find template your template override!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment