Skip to content

Instantly share code, notes, and snippets.

@pranavmalaviya
Last active February 4, 2022 12:44
Show Gist options
  • Save pranavmalaviya/ff59a9e9d3325751bc173dd10ed451d9 to your computer and use it in GitHub Desktop.
Save pranavmalaviya/ff59a9e9d3325751bc173dd10ed451d9 to your computer and use it in GitHub Desktop.
Packer Ubuntu Bionic template
{
"builders": [
{
"type": "vmware-iso",
"vm_name": "ubuntu-18.04-amd64",
"format": "ova",
"iso_urls": [
"iso/ubuntu-18.04.6-server-amd64.iso",
"https://cdimage.ubuntu.com/ubuntu/releases/18.04.6/release/ubuntu-18.04.6-server-amd64.iso"
],
"iso_checksum": "file:http://cdimage.ubuntu.com/ubuntu/releases/18.04.6/release/SHA256SUMS",
"http_directory": "http",
"boot_wait": "5s",
"boot_command": [
"<wait5s>",
"<esc><wait>",
"<esc><wait>",
"<enter><wait>",
"/install/vmlinuz<wait>",
" auto<wait>",
" console-setup/ask_detect=false<wait>",
" console-setup/layoutcode=us<wait>",
" console-setup/modelcode=pc105<wait>",
" debconf/frontend=noninteractive<wait>",
" debian-installer=en_US.UTF-8<wait>",
" fb=false<wait>",
" initrd=/install/initrd.gz<wait>",
" kbd-chooser/method=us<wait>",
" keyboard-configuration/layout=USA<wait>",
" keyboard-configuration/variant=USA<wait>",
" locale=en_US.UTF-8<wait>",
" netcfg/get_domain=vm<wait>",
" netcfg/get_hostname=vagrant<wait>",
" grub-installer/bootdev=/dev/sda<wait>",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
" -- <wait>",
"<enter><wait>"
],
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"cpus": "{{ user `cpus` }}",
"memory": "{{ user `memory` }}",
"disk_size": "{{user `disk_size`}}",
"ssh_port": 22,
"ssh_timeout": "10000s",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"tools_upload_flavor": "linux",
"headless": "false",
"guest_os_type": "ubuntu-64",
"output_directory": "builds/packer-ubuntu-18.04-amd64-vmware",
"skip_export": false,
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ethernet0.pciSlotNumber": "32"
},
"vmx_remove_ethernet_interfaces": true
}
],
"provisioners": [
{
"environment_vars": [
"HOME_DIR=/home/vagrant",
"http_proxy={{user `http_proxy`}}",
"https_proxy={{user `https_proxy`}}",
"no_proxy={{user `no_proxy`}}"
],
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
"expect_disconnect": true,
"scripts": [
"{{template_dir}}/scripts/update.sh",
"{{template_dir}}/scripts/sshd.sh",
"{{template_dir}}/scripts/networking.sh",
"{{template_dir}}/scripts/sudoers.sh",
"{{template_dir}}/scripts/vagrant.sh",
"{{template_dir}}/scripts/virtualbox.sh",
"{{template_dir}}/scripts/vmware.sh",
"{{template_dir}}/scripts/cleanup.sh"
],
"type": "shell"
}
],
"variables": {
"cpus": "2",
"memory": "2048",
"disk_size": "8192",
"http_proxy": "{{env `http_proxy`}}",
"https_proxy": "{{env `https_proxy`}}",
"no_proxy": "{{env `no_proxy`}}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment