chef 11.8.2 + knife-solo 0.4.2 導入(OS X 10.8.5)


参考:『入門Chef Solo - Infrastructure as Code』
http://d.hatena.ne.jp/naoya/20130325/1364210529

## chef 11.8.2

```zsh
% curl -L http://www.opscode.com/chef/install.sh | sudo bash
% . ~/.zshrc
% knife -v
Chef: 11.8.2
```
gemでも可。

## knife-solo 0.4.2

```zsh
% git clone git://github.com/matschaffer/knife-solo.git
% cd knife-solo

knife-solo% gem install bundler                                                                     

knife-solo% bundle -v
Bundler version 1.0.0.rc.6

knife-solo% rake install --trace
** Invoke install (first_time)
** Invoke build (first_time)
** Execute build
rake aborted!
ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
    ["lib/knife-solo/resources/patch_cookbooks/chef-solo-search/.travis.yml", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/CHANGELOG", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/LICENSE", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/NOTICE", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/README.md", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search/overrides.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/search/parser.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene.treetop", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene_nodes.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/query_transform.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/metadata.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/recipes/default.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/Gemfile", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/node/alpha.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/node/beta.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/node/without_json_class.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/users/jerry.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/users/lea.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/users/mike.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/data/data_bags/users/tom.json", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_data_bags.rb", "lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb"] are not files

...

```
submoduleのコードをもってくる必要がある
http://blog.fkoji.com/2013/04301203.html

```zsh
knife-solo% git submodule init
knife-solo% git submodule update

knife-solo% rake install --trace
** Invoke install (first_time)
** Invoke build (first_time)
** Execute build
knife-solo 0.4.2 built to pkg/knife-solo-0.4.2.gem.
** Execute install
knife-solo (0.4.2) installed.
```

## vagrant環境でテスト
起動

```zsh
% cd vagranttest
vagranttest% vagrant up
```

ssh設定

```zsh
vagranttest% vagrant ssh-config --host melody >> ~/.ssh/config
```
余計な出力が出ている場合は削除

```zsh
% vim ~/.ssh/config

  7 You appear to be running Vagrant outside of the official installers.
  8 Note that the installers are what ensure that Vagrant has all required
  9 dependencies, and Vagrant assumes that these dependencies exist. By
 10 running outside of the installer environment, Vagrant may not function
 11 properly. To remove this warning, install Vagrant using one of the
 12 official packages from vagrantup.com.

```

仮想環境にchefがインストールされていることを確認

```zsh
% ssh melody knife -v
Chef: 11.8.0
```
knifo-solo実行

```zsh
% knife solo prepare melody  
                                                   
% ssh melody knife -v
Chef: 11.8.2
```
Chefのバージョンが上がった。