{
  "_comment": "Build with `packer build ubuntu.json`",
  "builders": [
    {
      "iso_urls": [ "output-base/base" ],
      "iso_checksum": "none",
      "disk_image": "true",
      "use_backing_file": "true",
      "headless": "{{ user `headless` }}",
      "disable_vnc": "true",
      "output_directory": "output-{{ user `vm_name` }}",
      "qemuargs": [
        [
          "-m",
          "{{ user `memory` }}"
        ],
        [
          "-display",
          "none"
        ],
        [
          "-machine",
          "accel=kvm"
        ],
        [
          "-cpu",
          "host"
        ],
        [
          "-smp",
          "cpus={{ user `cpus`}}"
        ]
      ],
      "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now",
      "ssh_password": "{{ user `ssh_password` }}",
      "ssh_timeout": "10000s",
      "ssh_username": "{{ user `ssh_username` }}",
      "type": "qemu",
      "vm_name": "{{ user `vm_name` }}"
    }
  ],
  "provisioners": [
    {
      "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
      "scripts": [
        "scripts/install-nopaxos.sh"
      ],
      "type": "shell"
    },
    {
      "type": "file",
      "source": "nopaxos.config",
      "destination": "/tmp/nopaxos.config",
      "direction": "upload"
    },
    {
      "type": "file",
      "source": "sequencer.config",
      "destination": "/tmp/sequencer.config",
      "direction": "upload"
    },
    {
      "type": "shell",
      "inline": ["sudo mv /tmp/nopaxos.config /root/nopaxos.config; sudo mv /tmp/sequencer.config /root/sequencer.config"]
    }
  ],
  "variables": {
    "cleanup_pause": "",
    "cpus": "4",
    "custom_script": ".",
    "desktop": "false",
    "disk_size": "10000",
    "headless": "", "hostname": "vagrant",
    "memory": "4096",
    "preseed": "preseed.cfg",
    "ssh_fullname": "vagrant",
    "ssh_password": "ubuntu",
    "ssh_username": "ubuntu",
    "vagrantfile_template": "",
    "version": "0.1.0",
    "vm_name": "nopaxos"
  }
}

