我正在使用 vagrant + chef-solo + barkshelf 插件。在我的 Vagrantfile 中,我有这个:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["chembl_18"]
},
"build_essential" => {
"compiletime" => true
}
}
如果我在这里添加更多配置,我的 Vagrantile 很快就会变得凌乱。我试图改变这一点,所以我创建了databags/postgresql/json_attribs.json
包含以下内容的文件:
{
"postgresql": {
"password": {
"postgres": "iloverandompasswordsbutthiswilldo"
}
}
}
并修改了我的 Vagrantfile 中的内容:
chef.json = {
:postgresql => ["json_attribs"],
"database" => {
"create" => ["chembl_18"]
},
...
}
但它不起作用,我得到:
==> default: 58>> default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
...
==> default: [2014-05-14T12:36:51+00:00] ERROR: Running exception handlers
==> default: [2014-05-14T12:36:51+00:00] ERROR: Exception handlers complete
==> default: [2014-05-14T12:36:51+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-05-14T12:36:51+00:00] FATAL: TypeError: can't convert String into Integer
那么我应该如何以及在哪里放置这些设置以便将它们分成几个单独的文件?