arch-boxes builds vagrant and cloud images via Hashicorp packer. The vagrant images are going to be uploaded to vagrantcloud.com, the cloud-images need to get signed manually and uploaded into a web directory.
We have the following requirements for building vagrant images and cloud-images via the arch-boxes project.
- Virtualization support:
egrep (vmx|svm) -o /proc/cpuinfo
- Hypervisors installed: virtualbox, qemu
- Hashicorp packer installed
arch-boxesAnsible role for deploying the project on a host. The role makes sure, that kernel modules are loaded, hypervisors and packer are installed and more
├── cloud.json (1) ├── controller.py (2) ├── generic-ci.sh (3) ├── http (4) │ ├── install-chroot.sh (5) │ ├── install-cloud.sh (6) │ └── install.sh (7) ├── LICENSE ├── local.json (8) ├── packer_cache (9) ├── provision (10) │ ├── cleanup.sh (11) │ ├── cloud-init.sh (12) │ ├── postinstall.sh (13) │ ├── qemu.sh (14) │ ├── virtualbox.sh (15) │ ├── vmware.sh (16) │ └── write_zeroes.sh (17) ├── README.md ├── STYLEGUIDE.md └── vagrant.json (18)
cloud.jsonfile is the packer configuration for
controller.pyis triggered via a systemd-timer unit every day and checks if a build needs to get triggered.
generic-ci.shis an abstraction layer for the testing environment and can be therefore ignored in production.
httpdirectory contains all scripts for a basic installation.
install-chroot.shis all code that needs to get executed for vagrant images in the arch-mount during installation.
install-cloud.shis the installation script for the qcow2 cloud-images. It get's executed during arch-mount and replaces
install.shis the code for partitioning the VM, making the filesystem and executing arch-mount.
local.jsonis for third-party users only. You can ignore it in production.
packer_cacheis the cache directory of packer for saving ISOs etc (When a local mirror is used this directory should be empty)
provisionis a directory with additional provisioning scripts, these scripts get executed after the installation process.
cleanup.shmakes sure to remove man pages, pacman cache etc.
cloud-init.shinstalls cloud-init and enables all cloud-init services
postinstall.shsets a hostname, timezone, locales and enables systemd-resolved.
qemu.shinstalls the qemu guest-agent.
virtualbox.shinstalls the virtualbox guest-agent.
vmware.shinstalls the vmware guest-agent.
write_zeroes.shshrinks the VM image size via writing zeroes into a tmpfile. This is maybe harmful to your SSD.
vagrant.jsonthis is the packer configuration for building vagrant images and uploading them to the vagrantcloud.
If you need to run an image build manually, you can do so via:
packer build -parallel=false -var 'headless=true' -var 'write_zeroes=yes' -except=vmware-iso vagrant.json
This line will start a build process for virtualbox and qemu. If you need debugging output you need to add the following environment variable in front of the command: