Skip to content

Instantly share code, notes, and snippets.

@feckert
Created August 16, 2019 07:05
Show Gist options
  • Save feckert/b2d8c0cb5cd1f480605251a9a6116ae8 to your computer and use it in GitHub Desktop.
Save feckert/b2d8c0cb5cd1f480605251a9a6116ae8 to your computer and use it in GitHub Desktop.
packer: opnsense build command
{
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<wait60>",
"installer<enter><wait2>",
"opnsense<enter><wait10>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<wait60>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<enter><wait2>",
"<wait60>",
"root<enter><wait2>",
"opnsense<enter><wait2>",
"8<enter><wait5>",
"dhclient em0<enter><wait10>",
"telnet {{ .HTTPIP }} {{ .HTTPPort }} | sed '1,/^$/d' >/conf/config.xml<wait><enter>",
"GET /config.xml HTTP/1.0<enter><enter>",
"echo 'PasswordAuthentication yes' >> /usr/local/etc/ssh/sshd_config<enter>",
"service openssh onestart<enter>"
],
"boot_wait": "3s",
"disk_size": "8192",
"guest_os_type": "FreeBSD_64",
"headless": true,
"http_directory": "http",
"iso_checksum_type": "sha256",
"iso_checksum": "ce0525586c4ce680a0d67e2ea9d419137b4eef714e77d7d1d2ed1236dc880f54",
"iso_urls": "./dl/{{ user `base_os` }}-{{user `base_version`}}-amd64-netinst.iso",
"ssh_username": "root",
"ssh_password": "opnsense",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "shutdown -p now",
"guest_additions_mode": "disable",
"virtualbox_version_file": ".vbox_version",
"vm_name": "{{ user `export_name`}}",
"output_directory": "./builds/{{ user `appliance`}}",
"vboxmanage": [
[
"modifyvm", "{{.Name}}",
"--memory", "1024"
],
[
"modifyvm", "{{.Name}}",
"--cpus", "1"
],
[
"modifyvm", "{{.Name}}",
"--boot1", "disk"
],
[
"modifyvm", "{{.Name}}",
"--boot2", "dvd"
],
[
"modifyvm", "{{.Name}}",
"--audio", "none"
],
[
"modifyvm", "{{.Name}}",
"--usb", "off"
]
],
"format": "ova"
}
]
}
PACKER_LOG=1 packer build \
-var "base_os=OPNsense" \
-var "base_version=19.7" \
-var "export_name=opnsense-build" \
-var "appliance=opnsense" \
-force \
./opnsense.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment