我有一个带有多个配置块的Vagrant文件,如下所示:
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_path
和puppet.module_path
?
好吧,它走得像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
请注意,您可以指定要使用的清单目录,而不是单个文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句