I have the Vagrantfile below. It may look funny but it gets the job done. 
I'm concerned about repeated runs of the provisioner. 

For the first host, foo02, this will print once. For bar02, it prints 
twice. For omg02, it prints thrice... and so forth

==> omg02: Running provisioner: shell...
    omg02: Running: inline script
[ ... ]


I realize this is probably due to the placement of 'config.vm.provision' 
but after moving it around a few places, the Vagrantfile either won't 
validate or there's some subsequent error. 

Can you help me understand the logic here and how the structure might be 
improved. 


BOX_IMAGE = "centos7-2018010301"
ENV["BRIDGE"] = "eno1"


systems = {
        'foo02' => '',
        'bar02' => '',
        'omg02' => '',
        }


Vagrant.configure("2") do |config|
 systems.each do |i,x|
    config.vm.define "#{i}" do |subconfig|
      subconfig.vm.box = BOX_IMAGE
      subconfig.ssh.username = "vagrant"
      subconfig.ssh.password = "lulz"
      subconfig.vm.hostname = "#{i}"
      subconfig.vm.network :public_network, auto_config: false, bridge: 
"#{ENV['BRIDGE']}"
        config.vm.provision "shell", inline: <<-SHELL
         /opt/puppetlabs/bin/puppet resource service puppet ensure=running 
enable=true
        SHELL
       config.vm.provider "virtualbox" do |v|
         v.name = "#{i}"
         v.customize ["modifyvm", :id, "--paravirtprovider", "kvm"]
         v.customize ["modifyvm", :id, "--autostart-enabled", "on"]
       end
    end
 end
end

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/13ef6f00-01de-402b-8512-b32650c12778%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to