{
    "builders": [
        {
            "type": "qemu",
            "communicator": "ssh",
            "headless": true,
            "disk_image": true,
            "cpus": "{{ user `cpus` }}",
            "memory": "{{ user `memory` }}",
            "iso_checksum": "file:https://cloud-images.ubuntu.com/bionic/current/SHA256SUMS",
            "iso_url": "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img",
            "qemuargs": [
                ["-smbios", "type=1,serial=ds=nocloud-net;instance-id=packer;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/"],
                ["-machine","pc-q35-4.2,accel=kvm:tcg,usb=off,vmport=off,dump-guest-core=off"]
            ],
            "http_directory": "scripts",
            "ssh_username": "ubuntu",
            "ssh_password": "ubuntu",
            "net_device": "virtio-net",
            "shutdown_command": "sudo shutdown --poweroff --no-wall now",
            "output_directory": "output-ubuntu1804",
            "vm_name": "ubuntu1804"
        }
    ],
    "provisioners": [
      {
        "type": "shell",
        "execute_command": "{{.Vars}} sudo -S -E bash '{{.Path}}'",
        "scripts": [
            "scripts/packages.sh",
            "scripts/cleanup.sh"
        ]
      }
    ],
    "variables": {
        "cpus": "4",
        "memory": "4096"
    }
}
