【发布时间】:2016-04-03 19:42:50
【问题描述】:
我在attributes/default.rb中有一个属性:
default["host_name"] = "domain.com"
并希望使用该属性的主机名创建 NGINX 的配置:
...
template "/etc/nginx/conf.d/#{@host_name}.conf" do
source 'domain.conf.erb'
owner 'root'
group 'root'
mode '0644'
end
...
但在构建过程中 - Chef 看不到 host_name:
...
[14:18:28][Step 1/1] Recipe: nginx_proxy::default
[14:18:28][Step 1/1] * template[/etc/nginx/conf.d/.conf] action create
[14:18:28][Step 1/1] - create new file /etc/nginx/conf.d/.conf
[14:18:28][Step 1/1] - update content in file /etc/nginx/conf.d/.conf rom none to cc9a26
...
这里有什么问题?到底能不能实现?
主厨文档没有为template 提及“动态”name。
【问题讨论】:
标签: ruby chef-infra