实际上尝试用 chef-solo 编写 wirst 食谱,我正在查找食谱 wordpress 来初始化我自己的网站。
但是几个小时我找不到这个错误的解决方案:
No resource or method named `template' for `Chef::Recipe "create_configs"'
在片段上:
template "#{project_config_dir}/database.php" do
source "database.php.erb"
mode 0440
owner "root"
group node['apache']['group']
variables(
'dev' => {
'type' => app_db_config['type'],
'hostname' => app_db_config['hostname'],
'port' => app_db_config['port'],
'username' => app_db_config['user'],
'password' => app_db_config['password'],
'database' => app_db_config['dababase'],
}
)
action :create
end
带有流浪文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :private_network, ip: "192.168.33.11", :bridge => 'en1: Wi-Fi (AirPort)'
config.vm.synced_folder "/Users/Tom/Documents/vagrant/destination_server/public", "/home/vagrant/public"
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode
vb.gui = false
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
config.vm.provision :shell, :inline => "/etc/init.d/networking restart"
config.vm.provision :shell, :inline => "sudo apt-get update -y"
config.vm.provision :shell, :inline => "sudo apt-get install ruby1.9.3 -y"
config.vm.provision :shell, :inline => "sudo apt-get install rubygems -y"
config.vm.provision :shell, :inline => "cd /home/vagrant && sudo ./postinstall.sh"
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "apt"
chef.add_recipe "bazaar"
chef.json = {
"mysql" => {
"server_debian_password" => "root",
"server_root_password" => "root",
"server_repl_password" => "root"
},
"run_list" =>["recipe[mysql::server]"]
}
chef.add_recipe "site"
end
end
有趣的想法是资源“目录”工作正常,但我在使用“执行”时遇到了同样的问题。
使用食谱 wordpress 并添加了所有需要的食谱,并且使用这两个资源可以很好地工作。
我有 11.10 版的厨师。使用 Vagrant 创建虚拟机
任何想法?需要帮助/提示该怎么做:/