Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostmanager does not update /etc/hosts on centos7 guests #11200

Closed
bbaassssiiee opened this issue Nov 15, 2019 · 2 comments
Closed

hostmanager does not update /etc/hosts on centos7 guests #11200

bbaassssiiee opened this issue Nov 15, 2019 · 2 comments

Comments

@bbaassssiiee
Copy link

Vagrant version

Vagrant 2.2.6

Host operating system

Darwin Kernel Version 18.7.0

Guest operating system

Centos 7.6

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

  # provision.yml runs on a vagrant up, packer.yml runs on packer build.
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "ansible/vagrant.yml"
    ansible.compatibility_mode = "2.0"
    ansible.galaxy_role_file = "ansible/requirements.yml"
    ansible.galaxy_roles_path = "ansible/roles"
    ansible.inventory_path = "ansible/inventory/vagrant.ini"
    ansible.verbose = "v"
   end

  # Preference order
  config.vm.provider "virtualbox"
  config.ssh.insert_key = false
  config.vm.box_check_update = true
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = false
  config.hostmanager.manage_guest = true

  plugins = [
    "vagrant-vbguest",
    "vagrant-hostmanager"
  ]

  plugins_to_install = plugins.select { |plugin| not Vagrant.has_plugin? plugin }
  if not plugins_to_install.empty? and ARGV[0] != "plugin"
    puts "Installing plugins: #{plugins_to_install.join(' ')}"
    if system "vagrant plugin install #{plugins_to_install.join(' ')}"
      exec "vagrant #{ARGV.join(' ')}"
    else
      abort "Installation of one or more plugins has failed. Aborting."
    end
  end
  if Vagrant.has_plugin?("vagrant-vbguest")
    config.vbguest.auto_update = false
  end

  config.vm.define :'vagrant-fileserver', autostart: true, primary: true do |fileserver_config|
    fileserver_config.vm.box = "redesign/centos7"
    fileserver_config.vm.hostname = "vagrant-fileserver"
    fileserver_config.vm.network "private_network", ip: "192.168.10.4"
    fileserver_config.vm.network "forwarded_port", id: 'ssh', guest: 22, host: 2204, auto_correct: false
    fileserver_config.vm.network "forwarded_port", id: 'sftp', guest: 2299, host: 2299, auto_correct: false
    fileserver_config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: false
    fileserver_config.vm.provider "virtualbox" do |vb|
      vb.name = "vagrant-fileserver"
      vb.gui = false
      vb.customize ["modifyvm", :id, "--memory", 512]
      vb.customize ["modifyvm", :id, "--vram", "64"]
    end
  end
  config.vm.define :'vagrant-bastion', autostart: true, primary: true do |jumphost_config|
    jumphost_config.vm.box = "redesign/centos7"
    jumphost_config.vm.hostname = "vagrant-bastion"
    jumphost_config.vm.network "private_network", ip: "192.168.10.5"
    jumphost_config.vm.network "forwarded_port", id: 'ssh', guest: 22, host: 2205, auto_correct: false
    jumphost_config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: false
    jumphost_config.vm.provider "virtualbox" do |vb|
      vb.name = "vagrant-bastion"
      vb.gui = false
      vb.customize ["modifyvm", :id, "--memory", 512]
      vb.customize ["modifyvm", :id, "--vram", "64"]
    end
  end
end

Debug output

demo:infrastructure bas$ vagrant plugin update vagrant-hostmanager
Updating plugins: vagrant-hostmanager. This may take a few minutes...
All plugins are up to date.
demo:infrastructure bas$ vagrant plugin list
vagrant-hostmanager (1.8.9, global)
  - Version Constraint: > 0
vagrant-parallels (2.0.1, global)
  - Version Constraint: > 0
vagrant-vbguest (0.20.0, global)
  - Version Constraint: > 0
vagrant-vmware-desktop (2.0.3, global)
  - Version Constraint: > 0
demo:infrastructure bas$ vagrant hostmanager
[vagrant-hostmanager:guest] Updating hosts file on the virtual machine vagrant-fileserver...
[vagrant-hostmanager:guest] Updating hosts file on the virtual machine vagrant-bastion...
demo:infrastructure bas$ vagrant ssh vagrant-fileserver
Last login: Fri Nov 15 15:45:45 2019 from 10.0.2.2
-bash-4.2$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Expected behavior

My hosts file should have the hosts

Actual behavior

Nothing changed

Steps to reproduce

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

@jbonhag
Copy link
Contributor

jbonhag commented Nov 15, 2019

Hi there,

Thanks for the detailed bug report. However, it looks like this functionality is provided by the vagrant-hostmanager plugin, so I would recommend reaching out to that project for assistance.

Their issues page can be found here: vagrant-hostmanager

Best of luck and have a great day!

@jbonhag jbonhag closed this as completed Nov 15, 2019
@ghost
Copy link

ghost commented Jan 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants