Skip to content

Instantly share code, notes, and snippets.

@njhowell
Created June 24, 2020 12:39
Show Gist options
  • Save njhowell/ce216470d6ed050e5b609244402aa00e to your computer and use it in GitHub Desktop.
Save njhowell/ce216470d6ed050e5b609244402aa00e to your computer and use it in GitHub Desktop.
Packer files
{
"builders": [
{
"type": "virtualbox-iso",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--memory", "{{ user `ram` }}" ],
[ "modifyvm", "{{.Name}}", "--vram", "36" ],
[ "modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}" ]
],
"guest_os_type": "Ubuntu_64",
"disk_size": "{{ user `virtualbox_disk_size` }}",
"headless": "{{ user `headless` }}",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "sha256",
"vm_name": "ubuntu-2004",
"boot_command": [
" <wait><enter><wait>",
"<f6><esc>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs>",
"/casper/vmlinuz ",
"initrd=/casper/initrd ",
"autoinstall ",
"ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu-20.04/ ",
"<enter>"
],
"boot_wait": "5s",
"http_directory": "../scripts/ubuntu/http",
"shutdown_command": "sudo systemctl poweroff",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
"ssh_timeout": "10000s",
"ssh_handshake_attempts": "30",
"guest_additions_mode": "disable",
"format": "ova"
},
{
"type": "vmware-iso",
"guest_os_type": "ubuntu-64",
"boot_command": [
" <wait><enter><wait>",
"<f6><esc>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs>",
"/casper/vmlinuz ",
"initrd=/casper/initrd ",
"autoinstall ",
"ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu-20.04/ ",
"<enter>"
],
"boot_wait": "5s",
"disk_size": "{{ user `vmware_disk_size` }}",
"disk_type_id": 0,
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "sha256",
"http_directory": "../scripts/ubuntu/http",
"shutdown_command": "sudo systemctl poweroff",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "vagrant",
"ssh_timeout": "10000s",
"ssh_handshake_attempts": "30",
"tools_upload_flavor": "linux",
"vm_name": "ubuntu-2004",
"vmdk_name": "ubuntu-2004",
"version" : 12,
"vmx_data":{
"numvcpus": "{{ user `cpus` }}",
"memsize": "{{ user `ram` }}",
"scsi0.virtualDev":"lsisas1068",
"tools.upgrade.policy":"manual"
}
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"scripts": [
"../scripts/ubuntu/apt.sh",
"../scripts/ubuntu/cleanup.sh"
]
}
],
"variables": {
"headless": "true",
"iso_checksum": "<Checksum of ISO using the algorithm specified in iso_checksum_type above>",
"iso_url": "<URL to ISO>",
"version": "0",
"ram": "2048",
"cpus": "2",
"virtualbox_disk_size": "8192",
"vmware_disk_size": "8291"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment