i have a Vagrant file with multiple provision blocks like this:
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
how can i eliminate the redundant puppet.manifest_path
and puppet.module_path
?
Well, it walks like Ruby and talks like Ruby, so chances are you can
%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
Note that you can specify a directory of manifests to be used, instead of a single file.