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

[Help Wanted] Possible to add a list of hostnames and IPs? #223

Open
optimizer404 opened this issue Jan 10, 2017 · 6 comments
Open

[Help Wanted] Possible to add a list of hostnames and IPs? #223

optimizer404 opened this issue Jan 10, 2017 · 6 comments

Comments

@optimizer404
Copy link

optimizer404 commented Jan 10, 2017

Is it possible to add a list of hostnames and IPs to my vagrant box / hostsync with vagrant-hostmanager?

Eg.
config.hostmanager.add_host '10.0.2.3', ['myotherhost.vagrantup.internal', 'myotherhost'] config.hostmanager.add_host '10.0.2.4', ['mysecondhost.vagrantup.internal', 'mysecondhost']

@optimizer404 optimizer404 changed the title Possible to add a list of hostnames and IPs? [Help Wanted] Possible to add a list of hostnames and IPs? Jan 10, 2017
javier-lopez added a commit to nebulosa/vagrant-hostmanager that referenced this issue Dec 5, 2017
@javier-lopez
Copy link

the attached commit allows to use:

config.hostmanager.extra_hosts  = [
      [
          '192.168.42.41', [
              'external-box.localdomain',
              'subdomain.external-box.localdomain',
          ]
      ],
  ]

To define external hosts entries within the vagrant-hostmanager plugin

@utrotzek
Copy link

I'm very interested in this feature. I would like to test it and give you feedback. How can I install your version? Is there a command to install your version of the plugin?

@javier-lopez
Copy link

Hello @utrotzek , I can think of two approaches to install the plugin:

  1. Download/Compile/Install locally, based on ability to install plugins from github hashicorp/vagrant#1829 (comment)

$ git clone https://github.com/javier-lopez/vagrant-hostmanager && cd vagrant-hostmanager
$ rake build
$ vagrant plugin install pkg/vagrant-hostmanager

  1. Download the upstream code and copy the modified files, https://github.com/devopsgroup-io/vagrant-hostmanager/pull/248/files

@foozmeat
Copy link

foozmeat commented Jan 4, 2018

@javier-lopez This patch is working for me. Would it be possible to get rid of the outer array structure?

config.hostmanager.extra_hosts = [ '172.28.128.100', ['db.dev']]

instead of

config.hostmanager.extra_hosts = [[ '172.28.128.100', ['db.dev']]]

@javier-lopez
Copy link

@foozmeat done, I've also uploaded the modified version to https://rubygems.org/gems/vagrant-hostmanager-ext while (if) the changes get merged.

To test it run:

vagrant plugin uninstall vagrant-hostmanager
vagrant plugin install   vagrant-hostmanager-ext

@utrotzek
Copy link

@javier-lopez sorry for the late response. Thanks for the hint and uploading to rubygems.

Unfortunately I get the following error message when running vagrant hostmanager

Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

cannot load such file -- vagrant-hostmanager-ext

With the original plugin hostmanager v1.8.7 everything works fine.

I installed it using

vagrant plugin uninstall vagrant-hostmanager
vagrant plugin install vagrant-hostmanager-ext

Do you have an idea what could be wrong? I have vagrant v1.9.2 installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants