Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
packer template for ubuntu
{
"variables": {
"vsphere_host": "vcenter65-1.vghetto.local",
"vsphere_user": "administrator@vghetto.local",
"vsphere_pass": "VMware1!",
"vsphere_datacenter": "Datacenter",
"vsphere_cluster": "\"VSAN-Cluster\"",
"vsphere_datastore": "virtual_machines",
"vsphere_network": "\"VM Network\""
},
"builders": [
{
"name": "ubuntu-14.04.amd64.vmware",
"type": "vmware-iso",
"guest_os_type": "ubuntu-64",
"iso_urls": [
"http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso",
"http://nl.releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso"
],
"iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
"iso_checksum_type": "md5",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "10000s",
"http_directory": "../http/ubuntu/",
"boot_wait": "5s",
"headless": true,
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{.Name}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>"
],
"shutdown_command": "echo 'vagrant' | sudo -S -E shutdown -P now",
"tools_upload_flavor": "linux",
"vmdk_name": "disk",
"disk_type_id": "0",
"vmx_data": {
"MemTrimRate": "0",
"sched.mem.pshare.enable": "FALSE",
"mainMem.useNamedFile": "FALSE",
"prefvmx.minVmMemPct": "100"
}
},
{
"name": "ubuntu-14.04.i386.vmware",
"type": "vmware-iso",
"guest_os_type": "ubuntu",
"iso_urls": [
"http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-i386.iso",
"http://nl.releases.ubuntu.com/14.04/ubuntu-14.04.5-server-i386.iso"
],
"iso_checksum": "812ac191b8898b33aed4aef9ab066b5a",
"iso_checksum_type": "md5",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "10000s",
"http_directory": "../http/ubuntu/",
"boot_wait": "5s",
"headless": true,
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz ",
"preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{.Name}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"initrd=/install/initrd.gz -- <enter>"
],
"shutdown_command": "echo 'vagrant' | sudo -S -E shutdown -P now",
"tools_upload_flavor": "linux",
"vmdk_name": "disk",
"disk_type_id": "0",
"vmx_data": {
"MemTrimRate": "0",
"sched.mem.pshare.enable": "FALSE",
"mainMem.useNamedFile": "FALSE",
"prefvmx.minVmMemPct": "100"
}
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | sudo -S -E sh {{.Path}}",
"override": {
"ubuntu-14.04.amd64.vmware": {
"scripts": [
"../script/ubuntu/update.sh",
"../script/ubuntu/network.sh",
"../script/common/vagrant.sh",
"../script/common/vmware.sh",
"../script/common/motd.sh",
"../script/ubuntu/cleanup.sh"
]
},
"ubuntu-14.04.i386.vmware": {
"scripts": [
"../script/ubuntu/update.sh",
"../script/ubuntu/network.sh",
"../script/common/vagrant.sh",
"../script/common/vmware.sh",
"../script/common/motd.sh",
"../script/ubuntu/cleanup.sh"
]
}
}
}
],
"post-processors": [
{
"type": "vsphere",
"keep_input_artifact": false,
"only": ["ubuntu-14.04.i386.vmware", "ubuntu-14.04.i386.vmware"],
"host": "{{user `vsphere_host`}}",
"username": "{{user `vsphere_user`}}",
"password": "{{user `vsphere_pass`}}",
"datacenter": "{{user `vsphere_datacenter`}}",
"cluster": "{{user `vsphere_cluster`}}",
"datastore": "{{user `vsphere_datastore`}}",
"vm_folder": "/",
"vm_name": "{{ build_name }}",
"vm_network": "{{user `vsphere_network`}}",
"insecure": "true"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment