Last active
January 31, 2017 09:03
-
-
Save weldpua2008/151fb1216fd9422fef1a253017be2d07 to your computer and use it in GitHub Desktop.
Packer template of ubuntu 14.04 with working ESXi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"execute_command": "echo {{user `ssh_pass`}}|sudo -S sh '{{.Path}}'", | |
"environment_vars": [ | |
"ssh_name={{user `ssh_name`}}", | |
"ssh_pass={{user `ssh_pass`}}" | |
], | |
"override": { | |
"virtualbox-iso": { | |
"scripts": [ | |
"scripts/base.sh", | |
"scripts/vagrant.sh \"{{user `ssh_name`}}\"", | |
"scripts/virtualbox.sh", | |
"scripts/cleanup.sh", | |
"scripts/zerodisk.sh" | |
] | |
}, | |
"vmware-iso": { | |
"scripts": [ | |
"scripts/base.sh", | |
"scripts/vagrant.sh", | |
"scripts/vmware.sh", | |
"scripts/cleanup.sh", | |
"scripts/zerodisk.sh" | |
] | |
} | |
} | |
} | |
], | |
"post-processors": [ | |
{ | |
"type": "vagrant", | |
"keep_input_artifact": true, | |
"only": ["virtualbox-iso"], | |
"override": { | |
"virtualbox": { | |
"output": "ubuntu-14-04-x64-virtualbox.box" | |
}, | |
"vmware": { | |
"keep_input_artifact": true, | |
"type": "compress", | |
"output": "actuallyAnOVAVMware.tar" | |
} | |
} | |
}, | |
{ | |
"type": "compress", | |
"only": ["vmware-iso"], | |
"keep_input_artifact": true, | |
"output": "actuallyAnOVA.tar" | |
} | |
], | |
"variables": { | |
"esx_remote_host": "{{env `esx_remote_host`}}", | |
"esx_remote_password": "{{env `esx_remote_password`}}", | |
"ssh_name": "radware", | |
"ssh_pass": "radware", | |
"hostname": "VM" | |
}, | |
"builders": [ | |
{ | |
"type": "virtualbox-iso", | |
"boot_command": [ | |
"<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>", | |
" debian-installer=en_US<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<wait>", | |
" netcfg/get_hostname={{user `hostname`}}<wait>", | |
" netcfg/get_domain=vagrantup.com<wait>", | |
" noapic<wait>", | |
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>", | |
" -- <wait>", | |
"<enter><wait>" | |
], | |
"boot_wait": "10s", | |
"disk_size": 40960, | |
"guest_os_type": "Ubuntu_64", | |
"http_directory": "http", | |
"iso_checksum": "9e5fecc94b3925bededed0fdca1bd417", | |
"iso_checksum_type": "md5", | |
"iso_url": "http://artifactory/ubuntu-images/ubuntu-14.04.3-server-amd64.iso", | |
"ssh_username": "{{user `ssh_name`}}", | |
"ssh_password": "{{user `ssh_pass`}}", | |
"ssh_port": 22, | |
"ssh_wait_timeout": "30000s", | |
"shutdown_command": "echo 'shutdown -P now' > /tmp/shutdown.sh; echo {{user `ssh_pass`}}|sudo -S sh '/tmp/shutdown.sh'", | |
"vboxmanage": [ | |
[ "modifyvm", "{{.Name}}", "--memory", "1024" ], | |
[ "modifyvm", "{{.Name}}", "--cpus", "1" ] | |
] | |
}, | |
{ | |
"type": "vmware-iso", | |
"vm_name": "packer_ubuntu_1404", | |
"output_directory": "output-{{ user `vm_name` }}-vmware-iso", | |
"boot_command": [ | |
"<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>", | |
" debian-installer=en_US<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<wait>", | |
" netcfg/get_hostname={{user `hostname`}}<wait>", | |
" netcfg/get_domain=vagrantup.com<wait>", | |
" noapic<wait>", | |
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>", | |
" -- <wait>", | |
"<enter><wait>" | |
], | |
"boot_wait": "10s", | |
"disk_size": 40960, | |
"guest_os_type": "Ubuntu-64", | |
"disk_type_id": "thin", | |
"http_directory": "http", | |
"iso_checksum": "9e5fecc94b3925bededed0fdca1bd417", | |
"iso_checksum_type": "md5", | |
"iso_url": "http://artifactory/artifactory/ubuntu-images/ubuntu-14.04.3-server-amd64.iso", | |
"remote_host": "{{user `esx_remote_host`}}", | |
"remote_datastore": "VPNFS", | |
"remote_cache_datastore": "VPNFS", | |
"remote_username": "root", | |
"remote_password": "{{user `esx_remote_password`}}", | |
"remote_type": "esx5", | |
"ssh_username": "{{user `ssh_name`}}", | |
"ssh_password": "{{user `ssh_pass`}}", | |
"ssh_port": 22, | |
"ssh_wait_timeout": "30000s", | |
"shutdown_command": "echo 'shutdown -P now' > /tmp/shutdown.sh; echo {{user `ssh_pass`}}|sudo -S sh '/tmp/shutdown.sh'", | |
"vmx_data": { | |
"virtualHW.version": "9", | |
"ethernet0.networkName": "VM Network", | |
"ethernet0.present": "TRUE", | |
"ethernet0.virtualDev": "vmxnet3", | |
"scsi0:0.fileName": "disk.vmdk", | |
"scsi0:0.present": "TRUE", | |
"scsi0:0.redo": "", | |
"memsize": "4096", | |
"numvcpus": "2", | |
"cpuid.coresPerSocket": "1" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment