Hello Nicolas
Based on what the source ami is (OS, packages, disk size), will be
easier add a new provider block in the packer template and have packer
to create one.
Few tips here,
Option 1, that I haven't used, is you can use packer with esx/vsphere
and you end with a vm there.
Option 2, is use packer locally to create a ovf + vmdk file and use
ovftool to create the ova
Option 3, there is a packer plugin that create ova after the build is complete
For option 1 the information is on the same vmware-iso
https://packer.io/docs/builders/vmware-iso.html
For option 3
https://github.com/gosddc/packer-post-processor-vagrant-vmware-ovf
I can comment on option 2, that is the one I use:
you will end with a output-vm-ovf folder and inside you will have a ovf file
My builder block looks like this:
{
"name": "vmware_server",
"type": "vmware-iso",
"vm_name": "{{user `hostname`}}",
"guest_os_type": "oraclelinux-64",
"headless": "false",
"http_directory" : "http",
"iso_url": "{{user `isourl`}}",
"iso_checksum": "{{user `isomd5`}}",
"iso_checksum_type": "md5",
"ssh_username": "{{user `ssh_name`}}",
"ssh_password": "{{user `ssh_pass`}}",
"tools_upload_flavor": "linux",
"boot_wait": "5s",
"boot_command": [
"<tab>",
" text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg ",
"<enter>"
],
"ssh_wait_timeout": "40m",
"shutdown_command": "shutdown -h now",
"shutdown_timeout": "40m",
"output_directory": "output-vmx-vmware_server",
"disk_size": 50000
},
then on the shell provisioner I have this:
{
"type": "shell",
"only": ["vmware_vagrant","vmware_server"],
"execute_command": "echo 'vagrant'| {{ .Vars }} sudo -E -S bash
'{{.Path}}'",
"pause_before": "5s",
"scripts": [
"scripts/vmware_tools.sh"
]
},
I have no post processor on this vmware_server builder so I end with
the files i mention
packer build -only vmware_server template.json
Then I run:
/Applications/VMware\ Fusion.app/Contents/Library/VMware\ OVF\
Tool/ovftool output-vmx-vmware_server/oracle6.vmx file.ova
and that's ist.
Alvaro
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
>
https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues:
https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
packer-tool...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/packer-tool/6abce65f-de32-46cc-a0d1-7dbfe2ca2d61%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.