devopsgroup-io/vagrant-hostmanager

breaks on parallel multi machine

xahare opened this issue · 3 comments

up to date (as of a few hours ago) fedora 26, with vagrant 1.97, vagrant-hostmanager 1.8.7, vagrant-libvirt 0.0.40

when hostmanager is enabled, but parallel provisioning is disabled, things work fine. the same vagrant file also works with parallel enabled, and host manager disabled. my ~/.vagrant.d/Vagrantfile has hostmanager enabled, manage guest enabled, manager host disabled.

# -*- mode: ruby -*-
# ENV['VAGRANT_NO_PARALLEL'] = 'yes'

lan = "10.46.5."

Vagrant.configure("2") do |config|
  # config.hostmanager.enabled = false
  config.vm.box = "centos/7"
  (1..3).each do |n|
    config.vm.define "node#{n}" do |node|
      node.vm.hostname = "node#{n}"
      node.vm.network "private_network", ip: "#{lan}#{10+n}"
    end
  end
end

During vagrant up, these pop up, the last line highlighted in red,

==> node3: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> node3: Removing domain...
==> node3: An error occurred. The error will be shown after all tasks complete.

full output to the point where it hangs

without debugging, https://gist.github.com/xahare/bd7794281632297af1901ad82e1f2728

having trouble with gist. will try again later with debugging logs

abbbi commented

hi,
i can reproduce this. Hostmanager is reproducible failing on me on paralell provision.
It seems there is a workaround that helps

  1. disable the general plugin and enable it to include offline vm's aswell, in case you need
    all the hosts entries.

config.hostmanager.enabled = false
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true

  1. enable the plugin during provision step for each vm:

centos7.vm.provision :hostmanager

this way i get up all my virtual machines in an paralell run without problems :)

Just writing in to say I also had a similar issue where my VMs would get deleted for some odd reason and making those changes to my config solved it.

My config reads like the following:

config.hostmanager.enabled = false
config.hostmanager.manage_guest = true
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true
# the following is part a specific vm config:
*.vm.provision :hostmanager
RoSk0 commented

Just faced with this as well.

Vagrant 2.2.6
vagrant-hostmanager 1.8.5