我要做的是传递两个值input1和input2到recipe/default.rb。
这些值来自jason文件。现在我使用这些输入来解析我的模板xml。
template "/tmp/temp_chef_sample.xml" do
source "temp_chef_sample.xml.erb"
variables( :fsIP => node[:hostname], :fsname => node[:ipaddress], :path=> node[:input1], :value=> node[:input2] )
end
我有两个问题。
- 如何在属性列表中添加属性"路径"one_answers"值"
- 如何在不使用json的情况下填充它们
您可以在许多地方设置节点属性。
食谱的属性文件
# cookbook/attributes/filename.rb
...
node.default[:input1] = 'somevalue'
...
环境、角色或节点对象
....
"default_attributes": {
"input1": "somevalue"
}
....