LoginSignup
6

More than 5 years have passed since last update.

posted at

updated at

chef-ruby_buildで入れたruby-buildを更新する

chefでrbenvを使ってrubyをインストールしようとしたところ以下のようなエラーに。

STDERR: Downloading ruby-2.0.0-p247.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
/usr/local/bin/ruby-build: line 144: pushd: ruby-2.0.0-p247: No such file or directory

BUILD FAILED

どうやらruby-buildでソースをダウンロードする際に ftp.ruby-lang.org にhttpでアクセスできなくなったのが原因のようです。
現在はftpで取得するよう修正されています。

しかし、chef-ruby_buildを利用している場合、既にruby-buildがインストールされていると更新がかからないようになっているので、以下のようにruby_buildのattributeにupgrade設定をする必要があります。

nodes/{host_name}.json
{
  "ruby_build": {
    "upgrade": "sync"
  },
  "rbenv": {
    "user_installs": [
      {
        "user": "app",
        "rubies": ["2.0.0-p247"],
        "global": "2.0.0-p247",
        "gems": {
          "2.0.0-p247": [
            { "name": "bundler" }
          ]
        }
      }
    ]
  },
  "run_list": [
    "recipe[ruby_build]",
    "recipe[rbenv::user]"
  ]
}

upgrade設定をしたあとにcookすると正しくインストールできました。

knife solo cook {host_name}

参考

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
6