Templates 流浪汉-厨师-模板文件检查
如何将其导出以测试是否存在模板文件 我只想在没有其他适当配置的情况下加载webserver default.conf.erb 我也这么想,但没有成功Templates 流浪汉-厨师-模板文件检查,templates,chef-infra,vagrant,Templates,Chef Infra,Vagrant,如何将其导出以测试是否存在模板文件 我只想在没有其他适当配置的情况下加载webserver default.conf.erb 我也这么想,但没有成功 template "#{node[:nginx][:dir]}/sites-available/#{host_name}.loc.conf" do variables attribs if File.exists? ("/templates/default/#{host_name}.conf.erb")
template "#{node[:nginx][:dir]}/sites-available/#{host_name}.loc.conf" do
variables attribs
if File.exists? ("/templates/default/#{host_name}.conf.erb")
source "#{host_name}.conf.erb"
else
source "default.conf.erb"
end
notifies :reload, "service[nginx]"
end
这样一个概念(在的标签下)已经在chef中实现
只需将文件放在templates/host-{host\u name}/
中,而不是templates/default/