Gil*_*tes 2 ruby provisioning chef-infra vagrant
这就是我的Vagrantfile样子:
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.json = {
postgresql: {
password: {
postgres: 'password'
}
},
database: {
create: ['mydb']
},
'build-essential' => {
compiletime: true
}
}
chef.run_list = ['recipe[build-essential]', 'recipe[openssl]', 'recipe[postgresql::server]', 'recipe[database::postgresql]']
end
Run Code Online (Sandbox Code Playgroud)
我也用过precise32盒子.当我的VM启动后vagrant up,我得到很长的回溯,并显示错误消息undefined method:ruby'for Config:Module`.
有没有人遇到过这个?
安装"pg"gem似乎有问题:
================================================================================
Error executing action `install` on resource 'chef_gem[pg]'
================================================================================
Gem::Installer::ExtensionBuildError
-----------------------------------
ERROR: Failed to build gem native extension.
/opt/vagrant_ruby/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
..
..
checking for st.h... yes
creating extconf.h
creating Makefile
make
sh: 1: make: not found
Run Code Online (Sandbox Code Playgroud)
我建议阅读build-essentials cookbook 的文档.它建议设置"compiletime"属性以支持确保构建工具可用于编译RubyGems扩展.
以下json设置对我有用:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["encased_dev"]
},
"build_essential" => {
"compiletime" => true
}
}
Run Code Online (Sandbox Code Playgroud)
注意:
我后来发现有一个ruby配方也解决了这个问题(通过设置构建必需节点属性).将其添加到运行列表或使用数据库cookbook
| 归档时间: |
|
| 查看次数: |
3227 次 |
| 最近记录: |