サーバ技術者養成講座をChefでやってみた(2)Chefの準備(後編)

前回に続いてChefの準備です。今回でChefの準備が完了です。

knife-soloをインストールします。

mba:~ user1$ sudo gem install knife-solo
Password:
Fetching: mixlib-config-2.1.0.gem (100%)
Successfully installed mixlib-config-2.1.0
Fetching: mixlib-cli-1.5.0.gem (100%)
Successfully installed mixlib-cli-1.5.0
Fetching: mixlib-log-1.6.0.gem (100%)
Successfully installed mixlib-log-1.6.0
Fetching: mixlib-authentication-1.3.0.gem (100%)
Successfully installed mixlib-authentication-1.3.0
Fetching: mixlib-shellout-1.4.0.gem (100%)
Successfully installed mixlib-shellout-1.4.0
Fetching: mime-types-1.25.1.gem (100%)
Successfully installed mime-types-1.25.1
Fetching: systemu-2.5.2.gem (100%)
Successfully installed systemu-2.5.2
Fetching: yajl-ruby-1.2.0.gem (100%)
Building native extensions.  This could take a while...
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/ext/builder.rb:54: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Successfully installed yajl-ruby-1.2.0
Fetching: ipaddress-0.8.0.gem (100%)
Successfully installed ipaddress-0.8.0
Fetching: ohai-7.0.4.gem (100%)
Successfully installed ohai-7.0.4
Fetching: rest-client-1.6.7.gem (100%)
Successfully installed rest-client-1.6.7
Fetching: net-ssh-2.9.0.gem (100%)
Successfully installed net-ssh-2.9.0
Fetching: net-ssh-gateway-1.2.0.gem (100%)
Successfully installed net-ssh-gateway-1.2.0
Fetching: net-ssh-multi-1.2.0.gem (100%)
Successfully installed net-ssh-multi-1.2.0
Fetching: highline-1.6.21.gem (100%)
Successfully installed highline-1.6.21
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: diff-lcs-1.2.5.gem (100%)
Successfully installed diff-lcs-1.2.5
Fetching: hashie-2.1.1.gem (100%)
Successfully installed hashie-2.1.1
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: chef-zero-2.0.2.gem (100%)
Successfully installed chef-zero-2.0.2
Fetching: coderay-1.1.0.gem (100%)
Successfully installed coderay-1.1.0
Fetching: slop-3.5.0.gem (100%)
Successfully installed slop-3.5.0
Fetching: method_source-0.8.2.gem (100%)
Successfully installed method_source-0.8.2
Fetching: pry-0.9.12.6.gem (100%)
Successfully installed pry-0.9.12.6
Fetching: chef-11.12.4.gem (100%)
Successfully installed chef-11.12.4
Fetching: knife-solo-0.4.1.gem (100%)
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.
Successfully installed knife-solo-0.4.1
Parsing documentation for mixlib-config-2.1.0
Installing ri documentation for mixlib-config-2.1.0
Parsing documentation for mixlib-cli-1.5.0
Installing ri documentation for mixlib-cli-1.5.0
Parsing documentation for mixlib-log-1.6.0
Installing ri documentation for mixlib-log-1.6.0
Parsing documentation for mixlib-authentication-1.3.0
Installing ri documentation for mixlib-authentication-1.3.0
Parsing documentation for mixlib-shellout-1.4.0
Installing ri documentation for mixlib-shellout-1.4.0
Parsing documentation for mime-types-1.25.1
Installing ri documentation for mime-types-1.25.1
Parsing documentation for systemu-2.5.2
Installing ri documentation for systemu-2.5.2
Parsing documentation for yajl-ruby-1.2.0
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/yajl/yajl.bundle, skipping
Installing ri documentation for yajl-ruby-1.2.0
Parsing documentation for ipaddress-0.8.0
Installing ri documentation for ipaddress-0.8.0
Parsing documentation for ohai-7.0.4
Installing ri documentation for ohai-7.0.4
Parsing documentation for rest-client-1.6.7
Installing ri documentation for rest-client-1.6.7
Parsing documentation for net-ssh-2.9.0
Installing ri documentation for net-ssh-2.9.0
Parsing documentation for net-ssh-gateway-1.2.0
Installing ri documentation for net-ssh-gateway-1.2.0
Parsing documentation for net-ssh-multi-1.2.0
Installing ri documentation for net-ssh-multi-1.2.0
Parsing documentation for highline-1.6.21
Installing ri documentation for highline-1.6.21
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for diff-lcs-1.2.5
Installing ri documentation for diff-lcs-1.2.5
Parsing documentation for hashie-2.1.1
Installing ri documentation for hashie-2.1.1
Parsing documentation for rack-1.5.2
Installing ri documentation for rack-1.5.2
Parsing documentation for chef-zero-2.0.2
Installing ri documentation for chef-zero-2.0.2
invalid options: -SNw2
(invalid options are ignored)
Parsing documentation for coderay-1.1.0
Installing ri documentation for coderay-1.1.0
Parsing documentation for slop-3.5.0
Installing ri documentation for slop-3.5.0
Parsing documentation for method_source-0.8.2
Installing ri documentation for method_source-0.8.2
Parsing documentation for pry-0.9.12.6
Installing ri documentation for pry-0.9.12.6
Parsing documentation for chef-11.12.4
Installing ri documentation for chef-11.12.4
Parsing documentation for knife-solo-0.4.1
Installing ri documentation for knife-solo-0.4.1
26 gems installed

gem listで見てみます。

mba:~ user1$ gem list

*** LOCAL GEMS ***

~省略~
chef (11.12.4)
chef-zero (2.0.2)
~省略~
knife-solo (0.4.1)
~省略~
ohai (7.0.4)
~省略~

knifeコマンドの設定をします。いろいろと聞かれますが、デフォルトでよいのでリターンを連打します。

mba:~ user1$ knife configure
WARNING: No knife configuration file found
/Library/Ruby/Gems/2.0.0/gems/chef-11.12.4/lib/chef/mixin/path_sanity.rb:25: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Where should I put the config file? [/Users/user1/.chef/knife.rb] 
Please enter the chef server URL: https://mba.local:443 
Please enter an existing username or clientname for the API: [user1] 
Please enter the validation clientname: [chef-validator] 
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] 
Please enter the path to a chef repository (or leave blank): 
*****

You must place your client key in:
  /Users/user1/.chef/user1.pem
Before running commands with Knife!

*****

You must place your validation key in:
  /etc/chef-server/chef-validator.pem
Before generating instance data with Knife!

*****
Configuration file written to /Users/user1/.chef/knife.rb