2014年5月11日日曜日

ruby bundlerでchefを入れてみた

rbenvでrubyを入れられるようにしたので、次はchefを入れてみました。
今回はbundlerで入れるので、まずはGemfileを作成。
$ vim Gemfile
$ cat Gemfile
source 'https://rubygems.org'
gem 'chef'
gem 'berkshelf'

早速インストールを実行。
--pathでインストール先を指定する。
$ bundle --path vendor/bundle
Fetching source index from https://rubygems.org/
Resolving dependencies........................................................
Installing i18n 0.6.9
Installing multi_json 1.9.2
Installing activesupport 3.2.17
Installing addressable 2.3.6
Installing builder 3.2.2
Installing gyoku 1.1.1
Installing mini_portile 0.5.3
Installing nokogiri 1.6.1
Installing akami 1.2.1
Installing buff-ruby_engine 0.1.0
Installing buff-shell_out 0.1.1
Installing hashie 2.1.0
Installing chozo 0.6.1
Installing multipart-post 1.2.0
Installing faraday 0.8.9
Installing minitar 0.5.4
Installing rbzip2 0.2.0
Installing retryable 1.3.5
Installing buff-extensions 0.5.0
Installing varia_model 0.3.2
Installing buff-config 0.4.0
Installing buff-ignore 1.1.1
Installing hitimes 1.2.1
Installing timers 2.0.0
Installing celluloid 0.14.1
Installing nio4r 1.0.0
Installing celluloid-io 0.14.1
Installing erubis 2.7.0
Using json 1.8.1
Installing mixlib-log 1.6.0
Installing mixlib-authentication 1.3.0
Installing net-http-persistent 2.9.4
Installing net-ssh 2.8.0
Installing solve 0.8.2
Installing ffi 1.9.3
Installing gssapi 1.0.3
Installing httpclient 2.3.4.1
Installing little-plugger 1.1.3
Installing logging 1.8.2
Installing rubyntlm 0.1.1
Installing rack 1.5.2
Installing httpi 0.9.7
Installing nori 1.1.5
Installing wasabi 1.0.0
Installing savon 0.9.5
Installing uuidtools 2.1.4
Installing winrm 1.1.3
Installing ridley 1.5.3
Installing thor 0.18.1
Installing berkshelf 2.0.14
Installing chef-zero 2.0.2
Installing diff-lcs 1.2.5
Installing highline 1.6.21
Installing mime-types 1.25.1
Installing mixlib-cli 1.4.0
Installing mixlib-config 2.1.0
Installing mixlib-shellout 1.4.0
Installing net-ssh-gateway 1.2.0
Installing net-ssh-multi 1.2.0
Installing ipaddress 0.8.0
Installing systemu 2.5.2
Installing yajl-ruby 1.2.0
Installing ohai 7.0.2
Installing coderay 1.1.0
Installing method_source 0.8.2
Installing slop 3.5.0
Installing pry 0.9.12.6
Installing rest-client 1.6.7
Installing chef 11.12.2
Using bundler 1.6.1
Your bundle is complete!
It was installed into ./vendor/bundle

次にknife-soloを追加。
$ vim Gemfile
$ cat Gemfile
source 'https://rubygems.org'
gem 'chef'
gem 'berkshelf'
gem 'knife-solo'

インストールを実行。
「install」はつけてもつけなくてもよいみたい。
$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using i18n 0.6.9
Using multi_json 1.9.2
Using activesupport 3.2.17
Using addressable 2.3.6
Using builder 3.2.2
Using gyoku 1.1.1
Using mini_portile 0.5.3
Using nokogiri 1.6.1
Using akami 1.2.1
Using buff-ruby_engine 0.1.0
Using buff-shell_out 0.1.1
Using hashie 2.1.0
Using chozo 0.6.1
Using multipart-post 1.2.0
Using faraday 0.8.9
Using minitar 0.5.4
Using rbzip2 0.2.0
Using retryable 1.3.5
Using buff-extensions 0.5.0
Using varia_model 0.3.2
Using buff-config 0.4.0
Using buff-ignore 1.1.1
Using hitimes 1.2.1
Using timers 2.0.0
Using celluloid 0.14.1
Using nio4r 1.0.0
Using celluloid-io 0.14.1
Using erubis 2.7.0
Using json 1.8.1
Using mixlib-log 1.6.0
Using mixlib-authentication 1.3.0
Using net-http-persistent 2.9.4
Using net-ssh 2.8.0
Using solve 0.8.2
Using ffi 1.9.3
Using gssapi 1.0.3
Using httpclient 2.3.4.1
Using little-plugger 1.1.3
Using logging 1.8.2
Using rubyntlm 0.1.1
Using rack 1.5.2
Using httpi 0.9.7
Using nori 1.1.5
Using wasabi 1.0.0
Using savon 0.9.5
Using uuidtools 2.1.4
Using winrm 1.1.3
Using ridley 1.5.3
Using thor 0.18.1
Using berkshelf 2.0.14
Using chef-zero 2.0.2
Using diff-lcs 1.2.5
Using highline 1.6.21
Using mime-types 1.25.1
Using mixlib-cli 1.4.0
Using mixlib-config 2.1.0
Using mixlib-shellout 1.4.0
Using net-ssh-gateway 1.2.0
Using net-ssh-multi 1.2.0
Using ipaddress 0.8.0
Using systemu 2.5.2
Using yajl-ruby 1.2.0
Using ohai 7.0.2
Using coderay 1.1.0
Using method_source 0.8.2
Using slop 3.5.0
Using pry 0.9.12.6
Using rest-client 1.6.7
Using chef 11.12.2
Installing knife-solo 0.4.1
Using bundler 1.6.1
Your bundle is complete!
It was installed into ./vendor/bundle
Post-install message from knife-solo:
Thanks for installing knife-solo!
 
If you run into any issues please let us know at:
  https://github.com/matschaffer/knife-solo/issues
 
If you are upgrading knife-solo please uninstall any old versions by
running `gem clean knife-solo` to avoid any errors.
 
See http://bit.ly/CHEF-3255 for more information on the knife bug
that causes this.

chefのバージョンを確認する。
$ bundle exec chef-solo -v
Chef: 11.12.2

早速いろいろ試してみると、これにはまる
http://qiita.com/sakatuba@github/items/1548818b02735b2047ad
とりあえずchefのバージョンを下げてみます。
Gemfile修正
gem 'chef','~> 11.10.0'

今回はinstallとやろうとするとエラーになってupdateを薦められる
$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
You have requested:
  chef ~> 11.10.0
 
The bundle currently has chef locked at 11.12.2.
Try running `bundle update chef`

薦められたようにupdateを実行
$ bundle update chef
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using i18n 0.6.9
Using multi_json 1.9.2
Using activesupport 3.2.17
Using addressable 2.3.6
Using builder 3.2.2
Using gyoku 1.1.1
Using mini_portile 0.5.3
Using nokogiri 1.6.1
Using akami 1.2.1
Using buff-ruby_engine 0.1.0
Using buff-shell_out 0.1.1
Installing hashie 2.1.1 (was 2.1.0)
Using chozo 0.6.1
Using multipart-post 1.2.0
Using faraday 0.8.9
Using minitar 0.5.4
Using rbzip2 0.2.0
Using retryable 1.3.5
Using buff-extensions 0.5.0
Using varia_model 0.3.2
Using buff-config 0.4.0
Using buff-ignore 1.1.1
Using hitimes 1.2.1
Using timers 2.0.0
Using celluloid 0.14.1
Using nio4r 1.0.0
Using celluloid-io 0.14.1
Using erubis 2.7.0
Using json 1.8.1
Using mixlib-log 1.6.0
Using mixlib-authentication 1.3.0
Using net-http-persistent 2.9.4
Using net-ssh 2.8.0
Using solve 0.8.2
Using ffi 1.9.3
Using gssapi 1.0.3
Using httpclient 2.3.4.1
Using little-plugger 1.1.3
Using logging 1.8.2
Using rubyntlm 0.1.1
Using rack 1.5.2
Using httpi 0.9.7
Using nori 1.1.5
Using wasabi 1.0.0
Using savon 0.9.5
Using uuidtools 2.1.4
Using winrm 1.1.3
Using ridley 1.5.3
Using thor 0.18.1
Using berkshelf 2.0.14
Installing moneta 0.6.0
Installing chef-zero 1.7.3 (was 2.0.2)
Using diff-lcs 1.2.5
Using highline 1.6.21
Using mime-types 1.25.1
Using mixlib-cli 1.4.0
Using mixlib-config 2.1.0
Using mixlib-shellout 1.4.0
Using net-ssh-gateway 1.2.0
Using net-ssh-multi 1.2.0
Using ipaddress 0.8.0
Using systemu 2.5.2
Using yajl-ruby 1.2.0
Installing ohai 6.22.0 (was 7.0.2)
Using coderay 1.1.0
Using method_source 0.8.2
Using slop 3.5.0
Using pry 0.9.12.6
Installing puma 1.6.3
Using rest-client 1.6.7
Installing chef 11.10.4 (was 11.12.2)
Using knife-solo 0.4.1
Using bundler 1.6.1
Your bundle is updated!

chefのバージョンが変わっているのを確認。
$ bundle exec chef-solo -v
Chef: 11.10.4

0 件のコメント:

コメントを投稿