{
    "variables": {
        "iso_url": "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso",
        "iso_checksum": "fe694a34c0e2d30b9e5dea7e2c1a3892c1f14cb474b69cc5c557a52970071da5",
        "ui_mode": "cli",
        "vm_name": "alpine_cli.qcow2",
        "file_source": "README.rst",
        "setup_script": "setup.sh",
        "disk_size": "500"
    },
    "builders": [
        {
            "type": "qemu",
            "iso_url": "{{user `iso_url`}}",
            "iso_checksum": "{{user `iso_checksum`}}",
            "iso_checksum_type": "sha256",
            "shutdown_command": "poweroff",
            "headless": true,
            "ssh_username": "root",
            "ssh_password": "root",
            "vm_name": "{{user `vm_name`}}",
            "disk_interface": "ide",
            "disk_compression": true,
            "net_device": "e1000",
            "disk_size": "{{user `disk_size`}}",
            "boot_wait": "20s",
            "ssh_wait_timeout": "60s",
            "boot_command": [
                "root<enter><wait>",
                "echo 'root:root' | chpasswd<enter>",
                "ifconfig lo up<enter>",
                "ifconfig eth0 up && udhcpc -i eth0<enter><wait10>",
                "setup-sshd -c openssh<enter><wait>",
                "sed -i.orig '$aPermitRootLogin yes' /etc/ssh/sshd_config<enter>",
                "service sshd restart<enter><wait>"
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "script": "scripts/install.sh"
        },
        {
            "type": "shell",
            "inline": [
                "reboot"
            ]
        },
        {
            "type": "shell",
            "pause_before": "20s",
            "inline": [
                "apk upgrade --update-cache",
                "mkdir -p /tmp/uploads"
            ]
        },
        {
            "type": "shell",
            "script": "scripts/{{user `ui_mode`}}.sh"
        },
        {
            "type": "file",
            "source": "files/{{user `file_source`}}",
            "destination": "/tmp/uploads/"
        },
        {
            "type": "shell",
            "script": "scripts/{{user `setup_script`}}"
        },
        {
            "type": "shell",
            "script": "scripts/post_setup.sh"
        }
    ]
}
