Bento is a project that encapsulates [Packer](https://www.packer.io/) templates for building [Vagrant](https://www.vagrantup.com/) base boxes. A subset of templates are built and published to the [bento org](https://app.vagrantup.com/bento) on Vagrant Cloud. These published boxes serve as the default boxes for [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant/).
***NOTE:**
- Virutalbox 6.x requires disabling nat config that allows vbox 7.x guests to connect to the host. To use comment out lines #161 and #162 in bento/packer_templates/pkr-variables.pkr.hcl or add variable `vboxmanage = []` to os_pkrvars files.
- When running packer build command the output directory is relative to the working directory the command is currently running in. Suggest running packer build commands from bento root directory for build working files to be placed in bento/builds/(build_name) directory by default. If the output_directory variable isn't overwritten a directory called builds/(build_name) will be created in the current working directory that you are running the command from
## Using Public Boxes
Adding a bento box to Vagrant
```bash
vagrant box add bento/ubuntu-18.04
```
Using a bento box in a Vagrantfile
```ruby
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04"
end
```
### Building Boxes
#### Requirements
- [Packer](https://www.packer.io/) >= 1.7.0
- [Vagrant](https://www.vagrantup.com/)
- At least one of the following virtualization providers:
If the build is successful, your box files will be in the `builds` directory at the root of the repository.
#### KVM/qemu support for Windows
You must download [the iso image with the Windows drivers for paravirtualized KVM/qemu hardware](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso). You can do this from the command line: `wget -nv -nc https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O virtio-win.iso` and place it in the packer_templates/win_answer_files/ directory.
You can use the following sample command to build a KVM/qemu Windows box:
Templates for operating systems only available via license or subscription are also available in the repository, these include but are not limited to: Red Hat Enterprise Linux, and SUSE Linux Enterprise. As the ISOs are not publicly available the URL values will need to be overridden as appropriate. We rely on the efforts of those with access to licensed versions of the operating systems to keep these up-to-date.
### Networking/Firewalls
Most of the providers expect unrestricted access to networking in order to build as expected. We can't enumerate all possible firewall configurations but include some snippets below that might be useful to users.
Hyper-V Gen 2 VMs do not support floppy drives. If you previously provided resources using a floppy drive, you must add those files to your Gen 2 iso images, in particular:
-`autounattend.xml`: The Gen 2 `autounattend.xml` file supports EFI partitions. Update the `autounattend.xml` with the correct Windows version for your systems and ensure that the partitions are correct for your situation. You also need to manage the driver disk that holds the hyper-v guest services drivers and adjust the `autounattend.xml` file as appropriate.
-`base_setup.ps1`
### Testing the build with the test-kitchen
If you have successfully built a vagrant box using the bento tool, you should have the vagrant box and a metadata file in the `builds` folder. You can use these files to test the build with a test-kitchen configuration. Place your `kitchen.yml` and `bootstrap.sh` files inside the `templates` directory and run the following command to test the build.
```bash
kitchen test
```
## Bugs and Issues
Please use GitHub issues to report bugs, features, or other problems.
## Related projects
A huge thank you to these related projects from which we've taken inspiration and often used as a source for workarounds in complex world of base box building.
These basebox templates were converted from [veewee](https://github.com/jedi4ever/veewee) definitions originally based on [work done by Tim Dysinger](https://github.com/dysinger) to make "Don't Repeat Yourself" (DRY) modular baseboxes. Thanks Tim!
- Author: Chris McClimans ([chris@hippiehacker.org](mailto:chris@hippiehacker.org))