mno*_*tka 2 chef-infra vagrant chef-solo berkshelf vagrantfile
我正在使用vagrant + chef-solo + barkshelf插件.在我的Vagrantfile中我有这个:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["chembl_18"]
},
"build_essential" => {
"compiletime" => true
}
}
Run Code Online (Sandbox Code Playgroud)
如果我在这里添加更多配置,我的Vagrantile将很快变得凌乱.我试图改变这一点,所以我创建了databags/postgresql/json_attribs.json
包含以下内容的文件:
{
"postgresql": {
"password": {
"postgres": "iloverandompasswordsbutthiswilldo"
}
}
}
Run Code Online (Sandbox Code Playgroud)
和我的Vagrantfile中修改的内容:
chef.json = {
:postgresql => ["json_attribs"],
"database" => {
"create" => ["chembl_18"]
},
...
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我得到:
==> 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
Run Code Online (Sandbox Code Playgroud)
那么我应该如何以及在何处放置这些设置以将它们分成几个单独的文件?