Skip to content

Instantly share code, notes, and snippets.

@yutannihilation
Last active December 22, 2015 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yutannihilation/6481222 to your computer and use it in GitHub Desktop.
Save yutannihilation/6481222 to your computer and use it in GitHub Desktop.
Simple JSON definition file for Packer.
{
"builders": [
{
"type": "virtualbox",
"vm_name": "freebsd-packer",
"boot_wait": "10s",
"disk_size": 10240,
"guest_os_type": "FreeBSD_64",
"iso_checksum": "f0a320fd52383c42649d48ea545915a9",
"iso_checksum_type": "md5",
"iso_url": "C:\\PATH_TO_ISO\\FreeBSD-9.1-RELEASE-amd64-disc1.iso",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'shutdown -p now'|su -",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"512"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"1"
]
],
"http_directory": ".",
"boot_command": [
"<esc>",
"load geom_mbr",
"<enter>",
"load zfs",
"<enter>",
"boot -s",
"<enter>",
"<wait><wait><wait><wait><wait><wait><wait><wait><wait><wait>",
"/bin/sh<enter>",
"mdmfs -s 100m md1 /tmp<enter>",
"dhclient -l /tmp/dhclient.lease.em0 em0<enter>",
"<wait><wait><wait>",
"echo 'sleeping for 10 seconds, then running install script.'<enter>",
"sleep 10 ; fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh {{.Name}}<enter>",
"<wait10>"
]
}
],
"provisioners": [
{
"type": "shell",
"script": "postinstall.sh",
"override": {
"virtualbox": {
"execute_command": "cat '{{.Path}}' | su -"
}
}
}
],
"post-processors": [
{
"type": "vagrant",
"output": "freebsd-packer.box"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment