====== knife ====== ====== knife-xenserver ====== ===== インストール ===== root ユーザでログインし、gem でインストール # /opt/chef/embedded/bin/gem install knife-xenserver --no-ri --no-rdoc こんな感じでエラーが出ました Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/chef/embedded/bin/ruby /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.3/lib/mini_portile.rb:278:in `block in execute': Failed to complete configure task (RuntimeError) from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.3/lib/mini_portile.rb:270:in `chdir' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.3/lib/mini_portile.rb:270:in `execute' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.3/lib/mini_portile.rb:65:in `configure' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.3/lib/mini_portile.rb:108:in `cook' from extconf.rb:101:in `block in
' from extconf.rb:119:in `call' from extconf.rb:119:in `block in
' from extconf.rb:109:in `tap' from extconf.rb:109:in `
' NOKOGIRI_USE_SYSTEM_LIBRARIES=1 /opt/chef/embedded/bin/gem install nokogiri いろいろ調べたところ - libxml2とlibxsltをインストールする - NOKOGIRI_USE_SYSTEM_LIBRARIES=YES でシステムのライブラリを使う - grepがBSD版なのでgnu版にする - 環境変数のcolorが悪さをしている などが引っかかりましたがいずれも違ってました… で、奥のほうにあるconfigure.log ((/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/ext/nokogiri/tmp/ports/libxml2/2.8.0/configure.log))をのぞいたら……… (;゚д゚)アッ… ………ありましたよ奥さん。………ていうか、cがねーよと言われてます configure: error: no acceptable C compiler found in $PATH 証拠隠滅 # yum -y install gcc **orz** root ユーザでログインし、gem でインストール # /opt/chef/embedded/bin/gem install knife-xenserver --no-ri --no-rdoc Fetching: terminal-table-1.4.5.gem (100%) <省略…> Successfully installed knife-xenserver-1.4.3 13 gems installed 確認してみます # su - chefユーザ $ knife xenserver --help 使用方法が表示されたらOK ===== XenServerへの接続 ===== 接続情報を~/.chef/knife.rbへ追加します((ここに書かずにオプションで指定することもできます)) knife[:xenserver_password] = 'password' knife[:xenserver_username] = 'root' knife[:xenserver_host] = '192.168.xxx.xxx' ホストリストの表示をしてみます $ knife xenserver host list Connecting to XenServer host 192.168.xxx.xxx... +-----------------------------+--------------------------------------+ | NAME | UUID | +-----------------------------+--------------------------------------+ | XenServer-Dom0 | 9546a5d-41f7-4125-xxxx-xxxxxxxxxxxx | +-----------------------------+--------------------------------------+ ===== VMを作成する ===== knife xenserver vm create --vm-template 776cd54d-917c-de8a-xxxx-xxxxxxxxxxxx --vm-name hoge ===== VMの削除 ===== knife xenserver vm delete hoge