vagrant,chef の設定。起動するまで。NO.2
VirtualBox(Oracle)のダウンロードページが元に戻ってたのでインストール。
そして
vagrant box add
$ vagrant box add centos64 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box
vagrant up
[default] The guest additions on this VM do not match the install version of VirtualBox! This may cause things such as forwarded ports, shared folders, and more to not work properly. If any of those things fail on this machine, please update the guest additions and repackage the box. Guest Additions Version: 4.2.8 VirtualBox Version: 4.2.18
とりあえずスルー。
vagrant ssh
.ssh/configにHostの書き込み
$ vagrant ssh-config --host mm >>~/.ssh/config $ ssh mm Warning: Permanently added '[127.0.0.1]:2222' (RSA) to the list of known hosts.
このwarningがどうも消えない。スルー。
knife solo
$ knife solo prepare mm $ knife solo init chef-repo $ knife cookbook create hello -o site-cookbooks
レシピの作成
./site-cookbooks/hello/recipes/default.rb
package "vim-enhanced" do action :install end #service iptables stop #chkconfig iptables off service "iptables" do action [:stop,:disable] end
nodeファイル編集
{ "run_list":[ "recipe[hello]" ] }
ファイル構成
. └── vagrant ├── chef │ ├── chef-repo │ │ ├── cookbooks │ │ ├── data_bags │ │ ├── nodes │ │ │ └── mm.json │ │ ├── roles │ │ └── site-cookbooks │ │ ├── group │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── attributes │ │ │ ├── definitions │ │ │ ├── files │ │ │ │ └── default │ │ │ ├── libraries │ │ │ ├── metadata.rb │ │ │ ├── providers │ │ │ ├── recipes │ │ │ │ └── default.rb │ │ │ ├── resources │ │ │ └── templates │ │ │ └── default │ │ ├── hello │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── attributes │ │ │ ├── definitions │ │ │ ├── files │ │ │ │ └── default │ │ │ ├── libraries │ │ │ ├── metadata.rb │ │ │ ├── providers │ │ │ ├── recipes │ │ │ │ └── default.rb │ │ │ ├── resources │ │ │ └── templates │ │ │ └── default │ │ ├── httpd │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── attributes │ │ │ ├── definitions │ │ │ ├── files │ │ │ │ └── default │ │ │ ├── libraries │ │ │ ├── metadata.rb │ │ │ ├── providers │ │ │ ├── recipes │ │ │ │ └── default.rb │ │ │ ├── resources │ │ │ └── templates │ │ │ └── default │ │ ├── mysql │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── attributes │ │ │ ├── definitions │ │ │ ├── files │ │ │ │ └── default │ │ │ ├── libraries │ │ │ ├── metadata.rb │ │ │ ├── providers │ │ │ ├── recipes │ │ │ │ └── default.rb │ │ │ ├── resources │ │ │ └── templates │ │ │ └── default │ │ └── php │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── attributes │ │ ├── definitions │ │ ├── files │ │ │ └── default │ │ ├── libraries │ │ ├── metadata.rb │ │ ├── providers │ │ ├── recipes │ │ │ └── default.rb │ │ ├── resources │ │ └── templates │ │ └── default │ └── nodes │ └── mm.json └── vagrantfile
vagrantfileの編集
Vagrant::Config.run do |config| config.vm.box = "Cent64" config.vm.network :hostonly, "192.168.33.77" config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "./chef" chef.add_recipe "hello" end end