2014-11-21 28 views
1

我有多個規定塊顛沛流離的文件是這樣的:如何覆蓋供應商的默認值?

config.vm.provision "puppet" do |puppet| 
    puppet.manifests_path = "puppet/manifests" 
    puppet.module_path = "puppet/modules" 
    puppet.manifest_file = "first.pp" 
end 

config.vm.provision "puppet" do |puppet| 
    puppet.manifests_path = "puppet/manifests" 
    puppet.module_path = "puppet/modules" 
    puppet.manifest_file = "second.pp" 
end 

config.vm.provision "puppet" do |puppet| 
    puppet.manifests_path = "puppet/manifests" 
    puppet.module_path = "puppet/modules" 
    puppet.manifest_file = "third.pp" 
end 

怎樣消除冗餘puppet.manifest_pathpuppet.module_path

回答

3

嗯,走路像Ruby和像Ruby會談,因此機會是,你可以,你可以指定清單的目錄

%w{first second third}.each do |manifest| 
    config.vm.provision "puppet" do |puppet| 
    puppet.manifests_path = "puppet/manifests" 
    puppet.module_path = "puppet/modules" 
    puppet.manifest_file = "#{manifest}.pp" 
    end 
end 

注意要使用,而不是一個單一的文件。

+0

像魅力,thx工作。 – Yevgeniy 2014-11-21 10:47:55