Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef - template inside a provider not finding source

I have a little resource and provider for nginx sites which writes out a config file for a site.

action :start do
    template "/etc/nginx/sites-enabled/my_site" do
        source    "nginx_site.conf.erb"
        notifies  :reload, "service[nginx]"
    end
end

When I use it from another cookbook the template nginx_site.conf.erb is not found as chef is looking for a template where this resource is called from.

Is there a way to tell chef to look for a template inside the nginx resource & provider cookbook?

like image 897
henry.oswald Avatar asked May 20 '13 22:05

henry.oswald


1 Answers

You can set cookbook value for template.

action :start do
  template "/etc/nginx/sites-enabled/my_site" do
    source    "nginx_site.conf.erb"
    notifies  :reload, "service[nginx]"
    cookbook 'nginx'
  end
end
like image 173
Draco Ater Avatar answered Oct 12 '22 17:10

Draco Ater