Skip to content

Add macOS support to the vagrant role - #1981

Open
Odilhao wants to merge 1 commit into
theforeman:masterfrom
Odilhao:vagrant-role-macos-qemu-support
Open

Add macOS support to the vagrant role#1981
Odilhao wants to merge 1 commit into
theforeman:masterfrom
Odilhao:vagrant-role-macos-qemu-support

Conversation

@Odilhao

@Odilhao Odilhao commented Aug 17, 2026

Copy link
Copy Markdown
Member

Needed for theforeman/foremanctl#685, which asks for a forge bootstrap-vagrant command to bootstrap Vagrant and a hypervisor provider instead of pointing people at docs/vagrant.md. Used by theforeman/foremanctl#757.

The vagrant role only ever handled Fedora/CentOS with libvirt. This adds a macOS path (Vagrant, qemu, socket_vmnet, and the vagrant-qemu/vagrant-hostmanager plugins, all through Homebrew), and finishes automating the Linux path too: enabling libvirtd/virtnetworkd and adding the user to the libvirt group were still manual steps from docs/vagrant.md before this.

Tested end to end deploying foremanctl's dev VM on an Apple Silicon Mac.

The vagrant role only ever bootstrapped Fedora/CentOS with libvirt.
There's no way to run a Vagrant-managed VM on macOS, and the
libvirtd/virtnetworkd/group setup from docs/vagrant.md was still a
manual step even on Linux.

Split the role into linux.yml and macos.yml, dispatched from
main.yml the way roles/umask and roles/foreman_repositories already
do it:

- linux.yml keeps the existing COPR/vagrant-libvirt install, and now
  also enables libvirtd and virtnetworkd and adds the invoking user
  to the libvirt group, so nothing from docs/vagrant.md is left as a
  manual step.
- macos.yml installs Vagrant, qemu, socket_vmnet, and the
  vagrant-qemu and vagrant-hostmanager plugins through Homebrew, and
  starts the socket_vmnet daemon. socket_vmnet holds the root
  vmnet.framework membership itself, so `vagrant up` never needs to
  run under sudo, unlike vagrant-qemu's other vmnet backends.

New vagrant_qemu default variable mirrors vagrant_libvirt to gate
the macOS path the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Odilhao added a commit to Odilhao/foreman-quadlet that referenced this pull request Aug 17, 2026
foremanctl's containers are x86_64-only, and there was no way to run
forge on Apple Silicon at all: no host bootstrap step (theforeman#685), and
vagrant-qemu needs a different box format and networking setup than
vagrant-libvirt.

Adds `forge host-setup`, which installs Vagrant and a hypervisor
provider (libvirt on Linux, vagrant-qemu on macOS) through forklift's
vagrant role. On Apple Silicon the Vagrantfile now boots a native
arm64 CentOS Stream 10 guest through vagrant-qemu instead of emulating
the whole VM, with socket_vmnet giving it a real IP the way libvirt
does on Linux, and vagrant-hostmanager keeping /etc/hosts in sync so
the UI is reachable by hostname like it already is on Linux. A new
container_binfmt role registers qemu-user-static on the guest so it
can still run the existing x86_64 container images.

Only the quadlet VM is supported this way for now; client/database/proxy
still need libvirt. Running ./forge test against the qemu VM currently
fails several API tests, because the suite assumes the Foreman API is
reachable at the same address as SSH, which holds for libvirt but not
for vagrant-qemu's separate NAT and vmnet interfaces. Not fixed here.

Depends on theforeman/forklift#1981.
Odilhao added a commit to Odilhao/foreman-quadlet that referenced this pull request Aug 17, 2026
foremanctl's containers are x86_64-only, and there was no way to run
forge on Apple Silicon at all: no host bootstrap step (theforeman#685), and
vagrant-qemu needs a different box format and networking setup than
vagrant-libvirt.

Adds `forge host-setup`, which installs Vagrant and a hypervisor
provider (libvirt on Linux, vagrant-qemu on macOS) through forklift's
vagrant role. On Apple Silicon the Vagrantfile now boots a native
arm64 CentOS Stream 10 guest through vagrant-qemu instead of emulating
the whole VM, with socket_vmnet giving it a real IP the way libvirt
does on Linux, and vagrant-hostmanager keeping /etc/hosts in sync so
the UI is reachable by hostname like it already is on Linux. A new
container_binfmt role registers qemu-user-static on the guest so it
can still run the existing x86_64 container images.

Only the quadlet VM is supported this way for now; client/database/proxy
still need libvirt. Running ./forge test against the qemu VM currently
fails several API tests, because the suite assumes the Foreman API is
reachable at the same address as SSH, which holds for libvirt but not
for vagrant-qemu's separate NAT and vmnet interfaces. Not fixed here.

Depends on theforeman/forklift#1981.
Odilhao added a commit to Odilhao/foreman-quadlet that referenced this pull request Aug 17, 2026
foremanctl's containers are x86_64-only, and there was no way to run
forge on Apple Silicon at all: no host bootstrap step (theforeman#685), and
vagrant-qemu needs a different box format and networking setup than
vagrant-libvirt.

Adds `forge host-setup`, which installs Vagrant and a hypervisor
provider (libvirt on Linux, vagrant-qemu on macOS) through forklift's
vagrant role. On Apple Silicon the Vagrantfile now boots a native
arm64 CentOS Stream 10 guest through vagrant-qemu instead of emulating
the whole VM, with socket_vmnet giving it a real IP the way libvirt
does on Linux, and vagrant-hostmanager keeping /etc/hosts in sync so
the UI is reachable by hostname like it already is on Linux. A new
container_binfmt role registers qemu-user-static on the guest so it
can still run the existing x86_64 container images.

Only the quadlet VM is supported this way for now; client/database/proxy
still need libvirt. Running ./forge test against the qemu VM currently
fails several API tests, because the suite assumes the Foreman API is
reachable at the same address as SSH, which holds for libvirt but not
for vagrant-qemu's separate NAT and vmnet interfaces. Not fixed here.

Depends on theforeman/forklift#1981.
Odilhao added a commit to Odilhao/foreman-quadlet that referenced this pull request Aug 20, 2026
foremanctl's containers are x86_64-only, and there was no way to run
forge on Apple Silicon at all: no host bootstrap step (theforeman#685), and
vagrant-qemu needs a different box format and networking setup than
vagrant-libvirt.

Adds `forge host-setup`, which installs Vagrant and a hypervisor
provider (libvirt on Linux, vagrant-qemu on macOS) through forklift's
vagrant role. On Apple Silicon the Vagrantfile now boots a native
arm64 CentOS Stream 10 guest through vagrant-qemu instead of emulating
the whole VM, with socket_vmnet giving it a real IP the way libvirt
does on Linux, and vagrant-hostmanager keeping /etc/hosts in sync so
the UI is reachable by hostname like it already is on Linux. A new
container_binfmt role registers qemu-user-static on the guest so it
can still run the existing x86_64 container images.

Only the quadlet VM is supported this way for now; client/database/proxy
still need libvirt. Running ./forge test against the qemu VM currently
fails several API tests, because the suite assumes the Foreman API is
reachable at the same address as SSH, which holds for libvirt but not
for vagrant-qemu's separate NAT and vmnet interfaces. Not fixed here.

Depends on theforeman/forklift#1981.
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.

1 participant