cool, thanks Becky.  It looks like Im almost there, the null builder does 
exactly what I want and executes on the ESXi instead of the VM.. Now I need 
to find a way to have the null builder wait until after the vmware-iso 
builder is run before it starts. 

 The run order I need would look something like:

1- vmware-iso builder 
2- all provisioners used by vmware-iso (wait till complete)
3- null builder
4- script provisioner used by null builder
5- vsphere post processor

Is there a way to get one builder to wait on the other before starting?   
Am I approaching this wrong?

-Jon

On Thursday, August 4, 2016 at 1:24:21 AM UTC-4, Becky wrote:
>
> Hi Jon,
>
> Try out these  steps 
>
> variables.json
> ==============
>
> {
>     "esxi_host": "xxx.xxx.xxx.xxx",
>     "esxi_username": "root",
>     "esxi_password": "PassWordGoesHere"
> }
>
>
>
> runESXiCommands.json
> ===================
> {
>     "builders": [{
>         "type": "null",
>         "name": "BUILDER-EXEC-ESXI-CMD",
>         "ssh_host": "{{user `esxi_host`}}",
>         "ssh_username": "{{user `esxi_username`}}",
>         "ssh_password": "{{user `esxi_password`}}"
>     }],
>     "provisioners": [{
>         "type": "shell",
>         "only": ["BUILDER-EXEC-ESXI-CMD"],
>         "scripts": [
>             "runESXiCommands.sh"
>         ]
>     }
>     ]
> }
>
>
> runESXiCommands.sh << This script  will be executed on ESXi and make sure 
> that SSH is Open on ESXi >>
> ==================
> #!/bin/sh
>
> vim-cmd vmsvc/convert.toTemplate
>
>
> packer validate -var-file=variables.json runESXiCommands.json
>
> packer build -only=BUILDER-EXEC-ESXI-CMD -var-file=.variables.json 
> runESXiCommands.json
>
>
> Regards,
>
>
>
> On Thursday, August 4, 2016 at 3:08:36 AM UTC+5:30, Jon Hittner wrote:
>>
>> Thanks, but unfortunately that doesn't work in my case as we don't use 
>> virtualbox/vagrant.   We are using the vmware-iso builder to build the 
>> image using a remote esxi box (remote_type esx5) and the the vsphere 
>> post-processor to upload to our vcenter.   Unless Im missing it, I don't 
>> think the ovftool has the ability to convert a vmware virtual machine on a 
>> vsphere to a vmware template.   
>>
>> Maybe there is a way to do it during the builder phase after the machine 
>> is shutdown as a final step.   The esxi shell has a "vim-cmd 
>> vmsvc/convert.toTemplate" although I havent figured out how to get the 
>> builder to run a command on the remote esxi machine that the image is being 
>> built, or how to pass it the vmid that that command would need.
>>
>> any ideas?
>>
>> -Jon
>>
>> On Wednesday, August 3, 2016 at 4:48:45 PM UTC-4, Stan Dorsett wrote:
>>>
>>> I've posted some blog posts around the approach the team I work on uses:
>>>
>>> https://sdorsett.github.io/2015/12/27/using-ovftool-to-export-packer-generated-virtual-machines/
>>> https://sdorsett.github.io/2015/12/28/scripted-packer-build-and-export/
>>>
>>> Stan
>>>
>>> On Wed, Aug 3, 2016 at 2:52 PM, Jon Hittner <[email protected]> wrote:
>>>
>>>> I'm using the vsphere post-provisioner to upload the vmx output from 
>>>> the vmware-iso builder to my vcenter.   It works well, but the result is a 
>>>> virtual machine.   Is there any way to have the provisioner convert the 
>>>> virtual machine to a template, or does anyone have a workflow that already 
>>>> does this?
>>>>
>>>> -- 
>>>> 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 [email protected].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/packer-tool/7947f7e7-45c6-43bc-9e0c-7dace856daa4%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/packer-tool/7947f7e7-45c6-43bc-9e0c-7dace856daa4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/469f216f-d5b2-406a-ab97-b1d4036e74f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to