2014-11-21 56 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