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

Document and/or improve having virtualbox as a provider choice #836

Open
thomasmckay opened this issue Sep 26, 2018 · 4 comments
Open

Document and/or improve having virtualbox as a provider choice #836

thomasmckay opened this issue Sep 26, 2018 · 4 comments

Comments

@thomasmckay
Copy link
Contributor

I see some docs[1] and other references to virtualbox in this repo but am not sure how to set the provider in my boxes.yaml file. I'm hoping it's a simple config per-box and I'll PR to update the docs.

Pinging @bastilian @ehelms - Any pointers or examples?

[1] https://github.com/theforeman/forklift/blob/8b95b1a2d9cb78e2675025400b748344d23e14ea/docs/production.md#using-virtualbox-windows-os-x

@ekohl
Copy link
Member

ekohl commented Sep 26, 2018

We don't set this in boxes. It's part of core vagrant and thus documented there: https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider

@thomasmckay
Copy link
Contributor Author

Thanks! I'll make small doc PR to note that (I see it is noted in the following libvirt section).

@thomasmckay
Copy link
Contributor Author

Working through trying to get forklift to provision properly and would welcome assistance. If there is a better forum to interact (discourse or IRC), please let me know.

A hand-crafted Vagrantfile has this:

  config.vm.network "private_network",
                    :type => 'hostonly',
                    :name => 'vboxnet1',
                    :adapter => 2,
                    :ip => '192.168.57.111'

This works, though the IP is not the one specified but seemingly the next one in order of availability(?).

The equivalent 99-local.yaml has this:

vbtmp:
  primary: true
  box: centos7
  ansible:
    group: 'devel'
    variables:
      ssh_forward_agent: true
  memory: 1024
  cpus: 1
  domain: example.com
  networks:
    - type: 'private_network'
      options:
        type: hostonly
        ip: 192.168.57.112
        name: 'vboxnet1'
        adapter: 2

which generates an error on vagrant up vbtmp --provider virtualbox:

Bringing machine 'vbtmp' up with 'virtualbox' provider...
==> vbtmp: Importing base box 'centos/7'...
==> vbtmp: Matching MAC address for NAT networking...
==> vbtmp: Checking if box 'centos/7' is up to date...
==> vbtmp: Setting the name of the VM: forklift_vbtmp_1538010090125_27015
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8080 is already in use
on the host machine.

To fix this, modify your current project's Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:

  config.vm.network :forwarded_port, guest: 80, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding. You could
try 'vagrant reload' (equivalent of running a halt followed by an up)
so vagrant can attempt to auto-correct this upon booting. Be warned
that any unsaved work might be lost.

If there is anyone that can assist, please let me know. Thanks!

@thomasmckay
Copy link
Contributor Author

Adding 'devel' to the box name got past the above error (as it was actually trying to override port 80 again).

The working configuration:

    - type: 'private_network'
      options:
        type: dhcp
        ip: 192.168.57.112
        name: 'vboxnet1'
        adapter: 2

or to actually set the ip address

    - type: 'private_network'
      options:
        type: static
        ip: 192.168.57.112
        name: 'vboxnet1'
        adapter: 2

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

2 participants