{
    "variables": {
        "user": "slapos",
        "password": "slapos",
        "disk_size": "200000",
        "domain": ""
    },

    "builders":
    [
        {
            "name": "debian8-vm-bootstrap",

            "type": "qemu",
            "format": "qcow2",
            "accelerator": "kvm",
            "disk_size": "{{ user `disk_size`}}",

            "iso_url": "http://cdimage.debian.org/debian-cd/8.7.1/amd64/iso-cd/debian-8.7.1-amd64-netinst.iso",
            "iso_checksum": "453312bf56fc45669fec5ebc0f025ac7",
            "iso_checksum_type": "md5",

            "http_directory": "http",

            "ssh_username": "{{user `user`}}",
            "ssh_password": "{{user `password`}}",
            "ssh_wait_timeout": "1800s",
            "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -h now",

            "headless": true,
            "boot_wait": "2s",
            "boot_command": [
                   "<esc><wait><wait>",
                   "install auto ",
                   "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-debian8.cfg ",
                   "debian-installer=en_US locale=en_US keymap=fr ",
                   "netcfg/get_hostname={{ .Name }} ",
                   "netcfg/get_domain={{ user `domain`}} ",

                   "fb=false debconf/frontend=noninteractive ",

                   "passwd/user-fullname={{user `user`}} ",
                   "passwd/user-password={{user `password`}} ",
                   "passwd/user-password-again={{user `password`}} ",
                   "passwd/username={{user `user`}} ",

                   "<enter>"
            ]
        }
    ],

    "provisioners": [
        {
            "type": "shell",
            "execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
            "scripts": [
                "scripts/update.sh",
                "scripts/packages.sh",
                "scripts/cleanup.sh",
                "scripts/vm-bootstrap.sh"
            ]
        }
    ]
}
