Vagrant+ChefでUbuntuサーバに「最低限必要なもの」をインストールする


#システム環境
・作業環境：OSX　10.8.4
・試験環境：Vagrant　+　Ubuntu12.04　LTS
・Chef 11.4.4
・knife-solo 0.3.0

#試験環境上にChef-soloをインストール

```
$ knife solo prepare precise
Bootstrapping Chef...
--2013-07-23 14:03:00--  https://www.opscode.com/chef/install.sh
Resolving www.opscode.com (www.opscode.com)... 184.106.28.82
Connecting to www.opscode.com (www.opscode.com)|184.106.28.82|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6510 (6.4K) [application/x-sh]
Saving to: `install.sh'

100%[======================================>] 6,510       --.-K/s   in 0s

2013-07-23 14:03:01 (292 MB/s) - `install.sh' saved [6510/6510]

Downloading Chef 11.4.4 for ubuntu...
Installing Chef 11.4.4
Selecting previously unselected package chef.
(Reading database ... 37489 files and directories currently installed.)
Unpacking chef (from .../chef_11.4.4_amd64.deb) ...
Setting up chef (11.4.4-2.ubuntu.11.04) ...
Thank you for installing Chef!
Generating node config 'nodes/precise.json'...
```

#Chef　Solo環境の生成
```
$ knife solo init chef-repo
Creating kitchen...
Creating knife.rb in kitchen...
Creating cupboards...
Setting up Librarian...
```

#クックブック作成
```
$ knife cookbook create pkg -o site-cookbooks
** Creating cookbook pkg
** Creating README for cookbook: pkg
** Creating CHANGELOG for cookbook: pkg
** Creating metadata for cookbook: pkg
```
#レシピ編集
```
$ vi site-cookbooks/pkg/recipes/default.rb
%w{ etckeeper git tig vim-nox openssh-server iotop ifstat dstat linux-headers-generic ntp curl zsh}.each do |pkg|
	package pkg do
		action :install
	end
end
```
#JSONファイル編集
```
$ vi nodes/precise.json
{
	"run_list":[
		"pkg"
	]
}
```
#Chef Solo実行
```
$ knife solo cook precise
Running Chef on precise...
Checking Chef version...
Installing Librarian cookbooks...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.4.4
Compiling Cookbooks...
[2013-07-23T14:12:58+00:00] FATAL: No cookbook found in ["/home/vagrant/chef-solo/cookbooks-1", "/home/vagrant/chef-solo/cookbooks-2", "/home/vagrant/chef-solo/cookbooks-3"], make sure cookbook_path is set correctly.
Converging 12 resources
Recipe: pkg::default
  * package[etckeeper] action install
    - install version 0.61ubuntu2 of package etckeeper

  * package[git] action install
    - install version 1:1.7.9.5-1 of package git

  * package[tig] action install
    - install version 0.17-1ubuntu1 of package tig

  * package[vim-nox] action install
    - install version 2:7.3.429-2ubuntu2.1 of package vim-nox

  * package[openssh-server] action install (up to date)
  * package[iotop] action install
    - install version 0.4.4-4 of package iotop

  * package[ifstat] action install
    - install version 1.1-8 of package ifstat

  * package[dstat] action install
    - install version 0.7.2-2 of package dstat

  * package[linux-headers-generic] action install
    - install version 3.2.0.49.59 of package linux-headers-generic

  * package[ntp] action install (up to date)
  * package[curl] action install
    - install version 7.22.0-3ubuntu4.2 of package curl

  * package[zsh] action install
    - install version 4.3.17-1ubuntu1 of package zsh

Chef Client finished, 10 resources updated
```
openssh-serverとntpは既にインストール済みであった
あと、インストールは出来たけど、途中でFATALが出てたので、後で調べる

以上