Skip to content

Instantly share code, notes, and snippets.

@jchodakowski
Last active March 7, 2017 21:50
Show Gist options
  • Save jchodakowski/1b718595be804aa07ddadbfc220749d8 to your computer and use it in GitHub Desktop.
Save jchodakowski/1b718595be804aa07ddadbfc220749d8 to your computer and use it in GitHub Desktop.
Packer build template
{
"variables": {
"ssh_username": "root",
"ssh_password": "DpIVLUUSGQ89qQcb",
"chef_version": "12.5.1",
"chef_server": "{{env `CHEF_SERVER`}}",
"hostname": "{{env `VBRICK_HOSTNAME`}}",
"canonical_ami": "ami-33ea9424",
"iso_name": "ubuntu-14.04.5-server-amd64.iso",
"iso_source": "../../iso/",
"iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
"iso_checksum_type": "md5",
"preseed_path": "ubuntu-14.04.cis.cfg",
"memory": "4096",
"cpus": "2"
},
"builders": [{
"type": "virtualbox-iso",
"boot_command": ["<esc><wait>",
"<esc><wait>",
"<enter><wait>",
"/install/vmlinuz",
" auto=true",
" priority=critical",
" initrd=/install/initrd.gz",
" DEBCONF_DEBUG=5",
" packer/http=http://{{ .HTTPIP }}:{{ .HTTPPort }}",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}}",
" -- ",
"<enter>"
],
"headless": true,
"vrdp_bind_address": "0.0.0.0",
"vrdp_port_min": 5900,
"vrdp_port_max": 6000,
"vm_name": "{{user `hostname`}}",
"boot_wait": "10s",
"disk_size": 20000,
"hard_drive_interface": "sata",
"guest_os_type": "Ubuntu_64",
"http_directory": "resources",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_source`}}{{user `iso_name`}}",
"format": "ova",
"shutdown_command": "shutdown -P now",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_wait_timeout": "10000s",
"ssh_pty": true,
"keep_registered": true,
"guest_additions_mode": "disable",
"virtualbox_version_file": ".vbox_version",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory", "{{ user `memory` }}"
], [
"createhd",
"--filename", "output-virtualbox-iso/{{.Name}}-disk2.vdi",
"--size", "60000"
], [
"storageattach", "{{ .Name }}",
"--storagectl", "SATA Controller",
"--device", "0",
"--port", "1",
"--type", "hdd",
"--medium", "output-virtualbox-iso/{{.Name}}-disk2.vdi"
],
[
"modifyvm",
"{{.Name}}",
"--cpus", "{{ user `cpus` }}"
]
]
}],
"provisioners": [{
"type": "file",
"source": "resources/nessus_id_rsa.pub",
"destination": "/tmp/nessus_id_rsa.pub",
"only": ["virtualbox-iso"]
}, {
"type": "shell",
"script": "resources/nessus.sh",
"remote_folder": "/var/tmp",
"only": ["virtualbox-iso"]
}, {
"type": "shell",
"script": "resources/teardown.sh",
"remote_folder": "/var/tmp",
"except": ["virtualbox-iso"]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment