{
  "builders": [
    {
      "accelerator": "kvm",
      "boot_command": [
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz ",
        "initrd=/install/initrd.gz ",
        "auto=true ",
        "debconf/priority=critical ",
        "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=FR ",
        "keyboard-configuration/variant=FR console-setup/ask_detect=false ",
        "net.ifnames=0 ",
        "hostname={{ .Name }} ",
        "passwd/user-fullname={{user `user`}} ",
        "passwd/user-password-again={{user `password`}} ",
        "passwd/user-password={{user `password`}} ",
        "passwd/username={{user `user`}} ",
        "noapic ",
        "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-ubuntu.cfg ",
        "-- <enter>"
      ],
      "boot_wait": "2s",
      "disk_size": "{{ user `disk_size`}}000",
      "format": "qcow2",
      "headless": true,
      "http_directory": "http",
      "iso_checksum": "md5:e8264fa4c417216f4304079bd94f895e",
      "iso_url": "http://cdimage.ubuntu.com/releases/18.04.1/release/ubuntu-18.04.1-server-amd64.iso",
      "name": "ubuntu-18.04-server-{{ user `disk_size`}}G-{{ user `name`}}",
      "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -P now",
      "ssh_password": "{{user `password`}}",
      "ssh_timeout": "1800s",
      "ssh_username": "{{user `user`}}",
      "type": "qemu"
    }
  ],
  "provisioners": [
    {
      "execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
      "scripts": [
        "scripts/update-ubuntu.sh",
        "scripts/packages-ubuntu.sh",
        "scripts/grub-ubuntu.sh",
        "{{ user `custom_script` }}"
      ],
      "type": "shell"
    }
  ],
  "variables": {
    "custom_script": "scripts/empty.sh",
    "disk_size": "100",
    "domain": "",
    "name": "image",
    "password": "slapos",
    "user": "slapos"
  }
}

