LoginSignup
3
3

More than 5 years have passed since last update.

Vagrant up 時に、 Chef のバージョンをあげる

Posted at

最近、Vagrant と Chef を使って開発環境を構築しています。Mapnik をソースから入れる必要があって、

にある Cookbook のレシピを使ってインストールしようとしていたのですが、どうも失敗するので怪しいと思い、仮想マシンの Chef-client のバージョンを確認。

vagrant@precise32:~$ chef-client --version
Chef: 10.14.2

…古い。どうもこれが原因でインストールがされなかった模様です。

取り急ぎ以下のようなレシピを作り、アップデートすることで対応。not_if の部分、11.x のバージョンかどうかチェックしているのですが、バージョンが12に上がったらまた書き換えなくてはいけないので、本当はちゃんと数字としてチェックした方がいいと思います。only_if で、バージョンが10の場合だけってやったほうがまだマシかな。

chef-update/recipe/default.rb
package 'curl'

execute "Opscode Chef Client Installer for Ubuntu" do
  command 'curl -L https://www.opscode.com/chef/install.sh | sudo bash'
  not_if '/usr/bin/chef-client --version | /bin/grep "Chef: 11."'
end 

3
3
0

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
  3. You can use dark theme
What you can do with signing up
3
3