Skip to content

Examples

arm-vm

One ARM64 Linux VM. arch: arm64 pins the Vagrant box architecture, so Vagrant pulls the arm64 build of the box and the VM runs natively on an Apple Silicon or Graviton host. The default (amd64) leaves the box architecture unset, which is Vagrant's own default, so older boxes that don't advertise an architecture still work. VM targets only (no container form); the cloud targets are x86-64 only for now and refuse an arm64 machine.

Tested: Shows an arm64 VM and an exec check (run inside the machine, on the VM targets).

version: 1
name: arm-vm

networks:
  lab: { cidr: 10.70.0.0/24 }

machines:
  box:
    networks: { lab: 10 }
    arch: arm64
    services: [{ port: 22 }]
    vm:
      os: ubuntu-24.04
      provision: [provision/setup.sh]

checks:
  - name: the box runs natively on arm64
    from: box
    exec: uname -m
    expect: aarch64

Targets

vagrant. See Targets for what each means.

Checks

The spec's own:

  • the box runs natively on arm64 (exec)

Plus the checks Isoloom derives from its services and reach rules, run from every machine. See Checks.

Generated files

What isoloom generate writes for this spec, as committed next to it. Don't edit them: change the spec and generate again (isoloom check fails in CI when they're out of date).

.isoloom/vagrant/Vagrantfile

# Generated by isoloom from isoloom.yml. Don't edit: change isoloom.yml and run
# `isoloom generate`. `isoloom check` fails when this file is out of date.
# Start:  cd .isoloom/vagrant && vagrant up
# Stop:   cd .isoloom/vagrant && vagrant destroy -f

ROOT = File.expand_path("../..", __dir__)
# Copied into each VM: the project, without version control or generated files.
PROJECT = Dir.children(ROOT).reject { |e| [".git", ".isoloom", ".vagrant"].include?(e) }.sort
# ESXi (vagrant-vmware-esxi): ESXI_VIRTUAL_NETWORK lists port groups, comma-separated: the
# management network first, then one per network, in order (lab); a missing one reuses the last.
ESXI_NETWORKS = ENV.fetch("ESXI_VIRTUAL_NETWORK", "VM Network").split(",").map(&:strip)
LAB_NETWORKS = ["lab"]
def esxi_networks(nets)
  [ESXI_NETWORKS[0]] + nets.map { |n| ESXI_NETWORKS[1 + LAB_NETWORKS.index(n)] || ESXI_NETWORKS[-1] }
end

Vagrant.configure("2") do |config|
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.boot_timeout = 900

  config.vm.define "box" do |m|
    m.vm.box = "bento/ubuntu-24.04"
    m.vm.box_architecture = "arm64"
    m.vm.hostname = "box"
    m.vm.network "private_network", ip: "10.70.0.10", netmask: "255.255.255.0", virtualbox__intnet: "isoloom-arm-vm-lab", libvirt__network_name: "isoloom-arm-vm-lab", libvirt__dhcp_enabled: false
    m.vm.provider "virtualbox" do |v|
      v.name = "arm-vm · box"
      v.linked_clone = true
      v.cpus = 1
      v.memory = 1024
    end
    m.vm.provider "vmware_desktop" do |v|
      v.vmx["displayName"] = "arm-vm · box"
      v.vmx["numvcpus"] = "1"
      v.vmx["memsize"] = "1024"
    end
    m.vm.provider "parallels" do |v|
      v.name = "arm-vm · box"
      v.linked_clone = true
      v.cpus = 1
      v.memory = 1024
    end
    m.vm.provider "utm" do |v|
      v.name = "arm-vm · box"
      v.cpus = 1
      v.memory = 1024
    end
    m.vm.provider "qemu" do |v|
      v.smp = "cpus=1"
      v.memory = "1024M"
    end
    m.vm.provider "vmware_esxi" do |v|
      v.esxi_hostname = ENV.fetch("ESXI_HOSTNAME", "")
      v.esxi_hostport = ENV.fetch("ESXI_HOSTPORT", "22").to_i
      v.esxi_username = ENV.fetch("ESXI_USERNAME", "root")
      v.esxi_password = "env:ESXI_PASSWORD"
      v.esxi_disk_store = ENV["ESXI_DATASTORE"] if ENV["ESXI_DATASTORE"]
      v.esxi_virtual_network = esxi_networks(["lab"])
      v.guest_name = "arm-vm-box"
      v.guest_numvcpus = 1
      v.guest_memsize = 1024
    end
    m.vm.provider "libvirt" do |v|
      v.cpus = 1
      v.memory = 1024
    end
    PROJECT.each do |entry|
      m.vm.provision "file", source: File.join(ROOT, entry), destination: "/tmp/isoloom-project/#{entry}"
    end
    m.vm.provision "shell", name: "project", inline: "rm -rf /opt/isoloom && mv /tmp/isoloom-project /opt/isoloom"
    m.vm.provision "shell", name: "provision/setup.sh", inline: "cd /opt/isoloom && sh provision/setup.sh"
    m.vm.provision "shell", name: "checks", run: "never", path: "checks/box.sh", env: { "ISOLOOM_DERIVED" => ENV.fetch("ISOLOOM_DERIVED", "1") }
  end
end