C:\> vagrant plugin install vagrant-omnibus C:\> vagrant plugin list vagrant-login (1.0.1, system) vagrant-omnibus (1.4.1) vagrant-share (1.0.1, system)
Vagrant.configure("2") do |config| config.vm.box = "CentOS6.5" config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box" config.omnibus.chef_version = :latest config.vm.define :chef1 do |chef1| chef1.vm.network :forwarded_port, guest: 22, host: 2222, host_ip: "127.0.0.1", id: "ssh", auto_correct: true chef1.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--memory", 512] end chef1.vm.provision :chef_solo do |chef| chef.custom_config_path = "Vagrantfile.chef" chef.cookbooks_path = "./cookbooks" chef.add_recipe "hello" end end end
C:\Users\hoge\chef-repo> vagrant reload ※または vagrant up chef1
… Generating chef JSON and uploading... Running chef-solo... [2014-05-18T14:04:18+00:00] INFO: Forking chef instance to converge... [2014-05-18T14:04:18+00:00] INFO: *** Chef 11.12.4 *** [2014-05-18T14:04:18+00:00] INFO: Chef-client pid: 1981 [2014-05-18T14:04:25+00:00] INFO: Setting the run_list to ["recipe[hello]"] from CLI options [2014-05-18T14:04:25+00:00] INFO: Run List is [recipe[hello]] [2014-05-18T14:04:25+00:00] INFO: Run List expands to [hello] [2014-05-18T14:04:25+00:00] INFO: Starting Chef Run for vagrant-centos65.vagrantup.com [2014-05-18T14:04:25+00:00] INFO: Running start handlers [2014-05-18T14:04:25+00:00] INFO: Start handlers complete. [2014-05-18T14:04:25+00:00] INFO: Hello, Chef! ←← きたー [2014-05-18T14:04:25+00:00] INFO: Chef Run complete in 0.027871938 seconds [2014-05-18T14:04:25+00:00] INFO: Running report handlers [2014-05-18T14:04:25+00:00] INFO: Report handlers complete
[chef1] -- /vagrant The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!
[root@localhost vagrant]# /etc/init.d/vboxadd setup Removing existing VirtualBox non-DKMS kernel modules [ OK ] Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module [ OK ] Building the shared folder support module [ OK ] Building the OpenGL support module [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong) Doing non-kernel setup of the Guest Additions [ OK ]
[root@localhost vagrant]# cat /etc/redhat-release CentOS release 6.4 (Final)
C:\Users\hoge\chef-repo\cookbooks\hello\recipes> notepad default.rb
# # Cookbook Name:: hello # Recipe:: default # # Copyright 2013, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # log "Hello, Chef!" package "zsh" do action :install end
C:\Users\hoge\chef-repo> vagrant provision ==> chef1: Chef 11.12.4 Omnibus package is already installed. ==> chef1: Running provisioner: chef_solo... Generating chef JSON and uploading... Running chef-solo... [2014-05-18T14:16:58+00:00] INFO: Forking chef instance to converge... [2014-05-18T14:16:58+00:00] INFO: *** Chef 11.12.4 *** [2014-05-18T14:16:58+00:00] INFO: Chef-client pid: 2425 [2014-05-18T14:17:05+00:00] INFO: Setting the run_list to ["recipe[hello]"] from CLI options [2014-05-18T14:17:05+00:00] INFO: Run List is [recipe[hello]] [2014-05-18T14:17:05+00:00] INFO: Run List expands to [hello] [2014-05-18T14:17:05+00:00] INFO: Starting Chef Run for vagrant-centos65.vagrantup.com [2014-05-18T14:17:05+00:00] INFO: Running start handlers [2014-05-18T14:17:05+00:00] INFO: Start handlers complete. [2014-05-18T14:17:05+00:00] INFO: Hello, Chef! [2014-05-18T14:17:40+00:00] INFO: package[zsh] installing zsh-4.3.10-7.el6 from base repository ←← きたー [2014-05-18T14:17:52+00:00] INFO: Chef Run complete in 47.358591173 seconds [2014-05-18T14:17:52+00:00] INFO: Running report handlers [2014-05-18T14:17:52+00:00] INFO: Report handlers complete