Load boxes.yaml and allow vagrant-hostmanager to update hypervisor#500
Load boxes.yaml and allow vagrant-hostmanager to update hypervisor#500ianballou wants to merge 1 commit into
Conversation
|
How do we want to advertise this boxes.yaml file? Docs? Also this fixes #437 |
|
The failure was due to #497 |
| end | ||
| end | ||
|
|
||
| # Load user-local box definitions from boxes.yaml (gitignored) |
There was a problem hiding this comment.
Reminds me we should clean up the gitignore as it has some forklift-isms.
ekohl
left a comment
There was a problem hiding this comment.
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 |
|
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
left a comment
There was a problem hiding this comment.
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?
| user_boxes.each do |name, settings| | ||
| next if settings.nil? |
There was a problem hiding this comment.
| user_boxes.each do |name, settings| | |
| next if settings.nil? | |
| user_boxes.compact.each do |name, settings| |
| user_boxes.each do |name, settings| | ||
| next if settings.nil? | ||
| config.vm.define name do |override| | ||
| override.vm.box = ENV.fetch("FOREMANCTL_BASE_BOX", settings.fetch('box', 'centos/stream9')) |
There was a problem hiding this comment.
Should the order be reversed and have the settings take priority?
| override.vm.box = ENV.fetch("FOREMANCTL_BASE_BOX", settings.fetch('box', 'centos/stream9')) | |
| override.vm.box = settings.fetch('box') { ENV.fetch('FOREMANCTL_BASE_BOX', 'centos/stream9') } |
| next if settings.nil? | ||
| config.vm.define name do |override| | ||
| override.vm.box = ENV.fetch("FOREMANCTL_BASE_BOX", settings.fetch('box', 'centos/stream9')) | ||
| override.vm.hostname = settings.fetch('hostname', "#{name}.example.com") |
There was a problem hiding this comment.
Once you rebase, please respect the Vagrant domain here.
Why are you introducing these changes? (Problem description, related links)
What are the changes introduced in this pull request?
/etc/hostsis updated along with the VMs' hosts files.How to test this pull request
Steps to reproduce:
vagrant-hostmanagerand ensure the hypervisor's hosts file is updated.Checklist