Nathan - bhyve provisioning

New About Yours API Help
1.9 KB, Plain text
Hello all,

I've been working on finding a nice way to provision FreeBSD bhyve guests, and bootstrap them into my Ansible environment with minimal intervention.  The step I haven't found a good solution for is assignment of hostnames that match the guest names on the hypervisor.  In KVM/QEMU with linux guests, it is possible to set the serial number of the guest's virtual motherboard at the time of creation, and use something like `dmidecode` in the autoinstall to set the correct hostname; thus the VM is registered in DDNS on first boot.  In bhyve, it is my understanding that only the guest UUID or mac can be manually set, and the board serial is always BHYVE.  The problem with the uuid and mac of course is that they have to be formatted correctly, so there is not much room for freedom.  Currently, my workaround is to have the autoinstall set the hostname as the mac address, and after first boot I run a ` guest` that ssh's into the hypervisor, grabs the mac of the specified guest, ssh's into the guest using that mac, sets the correct hostname, installs the ansible dependencies, and reboots.  This is an ok workaround for my own gear, but this would not be a great solution for a system of any kind of scale -- besides, It would be great to get provisioning down from three to only two commands.  `vm create && install`, `ansible-playbook ...`.

A slightly more complex but more elegant solution might be to run a small database with an API somewhere in the environment, and POST and GET the necessary value pairs at the time of vm creation and vm installation.

I'm writing to see if you guys, or anyone else out there, have any ideas for the most elegant way to simply pass a string to a bhyve guest from the host, or, perhaps someone knows who I could get in contact with to learn how to implement this functionality in the bhyve source itself.  Given, of course, that I didn't miss something in the manpages.

Nathan Hensel
Pasted 11 months, 1 week ago — Expires in 27 days