[英]How to override “not default” attribute by vagrant with chef-solo?
I'm using vagrant with chef-solo provision. 我正在使用带有厨师独奏规定的流浪汉。
I saw openldap['rootpw']
in attribute of openldap 我在
openldap['rootpw']
属性中看到了openldap['rootpw']
I would like to override openldap['rootpw']
of attribute. 我想重写属性的
openldap['rootpw']
。
I tried to override configuration, following like 我试图覆盖配置,如下所示
# Vagrantfile
Vagrant::Config.run do |config|
config.vm.provision :chef_solo do |chef|
#....
chef.json = {
'rootpw' => 'xxxx....',
'openldap' => {
'rootpw' => 'xxxx....'
}
}
end
end
But, attribute was not overridden. 但是,属性没有被覆盖。
I think, it could override if attribute was default['openldap']['rootpw']
. 我认为,如果attribute为
default['openldap']['rootpw']
,则可以覆盖。
How to override " not default" attribute? 如何覆盖“ 非默认”属性?
Use override attributes. 使用替代属性。 You can set them in different places (recipe, role, environment), perhaps you can find the suitable for you.
您可以将它们设置在不同的位置 (配方,角色,环境),也许您可以找到适合自己的位置。
You cannot override a "not default" attribute as easily as a default because it evaluates lower down the chain. 您不能像默认值那样轻易地覆盖“非默认值”属性,因为它的评估价值较低。 Basically, the order is a continuum of default, force_default, normal,override, force_override, automatic.
基本上,顺序是默认值,force_default,normal,override,force_override,automatic的连续体。 If you want something to be overridden just go further down the list.
如果您想覆盖某些内容,请在列表中进一步查找。 It's best practice to use defaults and override them.
最佳做法是使用默认值并覆盖它们。
http://docs.opscode.com/essentials_cookbook_attribute_files.html#attribute-precedence http://docs.opscode.com/essentials_cookbook_attribute_files.html#attribute-precedence
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.