Closed Fuuzetsu closed 3 years ago
Are you setting the cookbook
property as well as the template
one to override the template? As i'm doing this in my wrapper and it works as expected, picking the template up from the wrapper cookbook instead of this one. Unless i'm misunderstanding what you mean.
What use cases are these configuration files that you wish to include? The cookbook and default nginx.conf
config template creates and includes a generic conf.d directory if that suits your use case. I'm not saying it can't be added but the idea with this cookbook was that the included templates would probably be overriden for all but the simplest use cases so that may be the better route.
I've added a test kitchen case for overriding the template as it works as expected, the resource syntax needs to be like so:
nginx_site 'foo' do
mode '0644'
cookbook 'test' # <-- Cookbook to source from
template 'override-site-template.erb' # <-- Template from above cookbook
variables(
'upstream' => {
'bar' => {
'server' => 'localhost:1234',
},
}
)
action :create
end
I think cookbook attribute is exactly what I need. I will try it tomorrow and report back.
I tried it today and it worked great. Thank you. I guess I should read more closely what attributes are available, sorry for the noise.
:person_frowning: Problem Statement
There seems to be no nice way to not use the default provider templates for
nginx_site
while at the same time having any custom templates included in nginx sites. This is becausetemplates
only looks in the cookbook template location, not in the local recipe.:grey_question: Possible Solution
list.conf
file. Something likeadd_to_list_resource
already does for nginx_site. If it's already possible, some docs would be great.:arrow_heading_up: Describe alternatives you've considered
Currently I'm writing stuff to
/etc/nginx/conf.http.d
viatemplate
manually, and creatinglist-custom.conf
file in there listing each of these.This is pretty manual and awful.