Skip to content

Load boxes.yaml - #500

Merged
ehelms merged 2 commits into
theforeman:masterfrom
ianballou:Vagrantfile-hostmanager-configure-host
Jul 1, 2026
Merged

ehelms merged 2 commits into
theforeman:masterfrom
ianballou:Vagrantfile-hostmanager-configure-host

Conversation

@ianballou

Copy link
Copy Markdown
Contributor

Why are you introducing these changes? (Problem description, related links)

What are the changes introduced in this pull request?

  • Adds hostmanager config, mainly so that the hypervisor's /etc/hosts is updated along with the VMs' hosts files.
  • Increases the dev box disk size to 50 to allow more space for long-lasting logs and Pulp.
  • Allows users to create a boxes.yaml file to add to the default box list in the Vagrantfile.

How to test this pull request

Steps to reproduce:

  • Try to create a boxes.yaml like
---
# User-local box definitions (this file is gitignored)
# Each entry becomes a vagrant box. Available settings:
#   box:       base box (default: centos/stream9)
#   hostname:  FQDN (default: <name>.example.com)
#   memory:    RAM in MB (default: 2048)
#   cpus:      CPU count (default: 1)
#   disk_size: disk in GB (default: unset)

katello-production:
  memory: 12288
  cpus: 4
  disk_size: 50
  • Try vagrant-hostmanager and ensure the hypervisor's hosts file is updated.

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

@ianballou

Copy link
Copy Markdown
Contributor Author

How do we want to advertise this boxes.yaml file? Docs?

Also this fixes #437

@ehelms

ehelms commented May 7, 2026

Copy link
Copy Markdown
Member

The failure was due to #497

Comment thread Vagrantfile
end
end

# Load user-local box definitions from boxes.yaml (gitignored)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminds me we should clean up the gitignore as it has some forklift-isms.

@ekohl ekohl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm never a fan of vagrant-hostmanager. Since #305 we configure the management network to have a DNS domain set so you actually have DNS between guests. The etc_hosts hack is no longer needed then.

The benefit is that it really works as a production system. Ruby's Resolv module famously has a line:

/etc/nsswitch.conf is not supported.

It may not be obvious, but glibc reads /etc/nsswitch.conf and if there's a files entry for hosts then it reads /etc/hosts. Foreman uses Resolv in some of its codebase, so

However, vagrant-libvirt only applies that to newly created networks so we should get people to migrate.

To also get the host to respond I use https://github.com/voxpupuli/setup-vagrant/blob/v0/network-hook to configure resolvectl. The only problem I have is that SELinux on my Fedora doesn't allow running Python for hooks. I think https://bugzilla.redhat.com/show_bug.cgi?id=2456505 is the same problem.

@ianballou

Copy link
Copy Markdown
Contributor Author

I'm never a fan of vagrant-hostmanager. Since #305 we configure the management network to have a DNS domain set so you actually have DNS between guests. The etc_hosts hack is no longer needed then.

The benefit is that it really works as a production system. Ruby's Resolv module famously has a line:

/etc/nsswitch.conf is not supported.

It may not be obvious, but glibc reads /etc/nsswitch.conf and if there's a files entry for hosts then it reads /etc/hosts. Foreman uses Resolv in some of its codebase, so

However, vagrant-libvirt only applies that to newly created networks so we should get people to migrate.

To also get the host to respond I use https://github.com/voxpupuli/setup-vagrant/blob/v0/network-hook to configure resolvectl. The only problem I have is that SELinux on my Fedora doesn't allow running Python for hooks. I think https://bugzilla.redhat.com/show_bug.cgi?id=2456505 is the same problem.

It's great to hear that we can rely on proper DNS between vagrant hosts. Having the hypervisor be able to connect to vagrant hosts is the more common issue (to me), so I'd like something 'official' for developers to follow. Do you think the network-hook that you mentioned could suit this? Whatever we end up going with, I'd like to have it in the developer documentation. If network-hook is a decent path forward, I'm happy to update the PR here to include a mention of it.

@ekohl

ekohl commented May 23, 2026

Copy link
Copy Markdown
Member

I found a solution to the SELinux issue and wrote up my notes in https://community.theforeman.org/t/setting-up-libvirt-with-dns-resolution-for-vagrant/46567.

@ekohl ekohl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to steer away from vagrant-hostmanager and direct to the DNS-based solution, but can see value in a boxes.yaml. Perhaps split it up?

Comment thread Vagrantfile Outdated
Comment thread Vagrantfile Outdated
Comment thread Vagrantfile Outdated
@ianballou
ianballou force-pushed the Vagrantfile-hostmanager-configure-host branch 2 times, most recently from 81a7e5b to 89829cc Compare June 30, 2026 17:23
@ianballou
ianballou requested a review from ekohl June 30, 2026 17:23
@ianballou

Copy link
Copy Markdown
Contributor Author

@ekohl to not let this linger longer I removed out the vagrant-hostmanager bits and scoped this down to only load the boxes.yaml file. I snuck in a disk boost to 50 GB since it's such a pain when you run out of disk, and 30 is so little to be running Pulp for a long time.

@ianballou
ianballou force-pushed the Vagrantfile-hostmanager-configure-host branch from 89829cc to a6ecaac Compare June 30, 2026 17:26
@ianballou ianballou changed the title Load boxes.yaml and allow vagrant-hostmanager to update hypervisor Load boxes.yaml Jun 30, 2026
- Update default disk to 50 GB
@ianballou
ianballou force-pushed the Vagrantfile-hostmanager-configure-host branch from a6ecaac to e91a66e Compare June 30, 2026 17:33
@ianballou
ianballou force-pushed the Vagrantfile-hostmanager-configure-host branch from 407bb05 to af44d17 Compare June 30, 2026 17:35
@ehelms
ehelms merged commit 374eb6a into theforeman:master Jul 1, 2026
14 checks passed
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

Successfully merging this pull request may close these issues.

3 participants