1
我使用的是Chef cookbook在我的Vagrant VM中安裝Git。根據default configuration,烹飪書應該安裝Git 2.8.1,但是我得到了Git 1.9.1。Vagrant:使用廚師安裝git
使用Chef安裝更新的Git版本的正確方法是什麼?爲了保持簡單的配置,我仍然想使用食譜。
這是我的配置至今:
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.berkshelf.enabled = true
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "git"
end
end
metadata.rb:
name 'vagrant-example'
recipe 'git', 'Installs git'
Berksfile:
source "https://supermarket.chef.io"
metadata
cookbook "git"
Berksfile.lock:
DEPENDENCIES
git
vagrant-example
path: .
metadata: true
GRAPH
build-essential (6.0.3)
compat_resource (>= 12.10)
mingw (>= 1.1)
seven_zip (>= 0.0.0)
chef_handler (1.4.0)
compat_resource (12.10.7)
dmg (2.4.0)
git (4.6.0)
build-essential (>= 0.0.0)
dmg (>= 0.0.0)
windows (>= 0.0.0)
yum-epel (>= 0.0.0)
mingw (1.2.4)
compat_resource (>= 0.0.0)
seven_zip (>= 0.0.0)
seven_zip (2.0.1)
windows (>= 1.2.2)
vagrant-example (0.0.0)
windows (1.44.1)
chef_handler (>= 0.0.0)
yum (3.11.0)
yum-epel (0.7.0)
yum (>= 3.6.3)
輸出遊民起來:
==> default: Installing Cookbook Gems:
==> default: Compiling Cookbooks...
==> default: Converging 1 resources
==> default: Recipe: git::package
==> default:
==> default: * git_client[default] action install
==> default:
==> default: * apt_package[default :create git] action install
==> default: [2016-08-14T01:11:04+00:00] INFO: apt_package[default :create git] installed git at 1:1.9.1-1ubuntu0.3
==> default: - install version 1:1.9.1-1ubuntu0.3 of package git
==> default:
==> default:
==> default:
==> default:
==> default: [2016-08-14T01:11:04+00:00] INFO: Chef Run complete in 13.492574359 seconds
我甚至嘗試指定使用主廚Vagrantfile屬性的版本,但它也沒有工作:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.berkshelf.enabled = true
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "git"
chef.json = {
"git" => {
"version" => "2.8.1"
}
}
end
end