post processor vsphere-template error

706 views
Skip to first unread message

Shankar Bala

unread,
Nov 16, 2017, 10:56:23 AM11/16/17
to Packer
Hi 

I am using packer version v1.1.1 and trying to build vm template..here is my sample json

{
  "variables": {
     "ks_path" : "packer_ks.cfg"
  },
  "builders": [{
    "type": "vmware-iso",
    "iso_url": "/var/www/html/ISOs/CentOS-6.8-x86_64-minimal.iso",
    "iso_checksum" : "0ca12fe5f28c2ceed4f4084b41ff8a0b",
    "iso_checksum_type" : "md5",
    "disk_type_id": "thin",
    "disk_size": "200000",
    "vmx_data": {
        "memsize": "4096",
        "numvcpus": "2",
        "ethernet0.networkName": "hx-vm-kickstart-10",
        "ethernet0.virtualDev": "vmxnet3",
        "ethernet0.present": "TRUE"
    },
    "boot_command" : [
       "<tab> text ks=http://kickstart/kickstart/packer.ks<enter><wait>"
    ],
    "boot_wait" : "30s",
    "ssh_username": "<username>",
    "ssh_password" : "<password>",
    "ssh_timeout" : "10000s",
    "remote_datastore": "hx-ds1",
    "remote_host": "<esxi ip>",
    "remote_password": "<esxi password>",
    "remote_type": "ex5",
    "remote_username": "root",
    "version": "11",
    "vm_name": "packer-test1",
    "vmdk_name": "packer-test1",
    "keep_registered": "true",
    "shutdown_command": "/usr/bin/sudo /sbin/shutdown -h now"
  }],
  "post-processors": [
    {
   "type": "vsphere-template",
   "host": "<esxi ip>",
   "insecure": true,
   "datacenter": "ha-datacenter",
   "username": "root",
   "password": "<esxi password>",
   "folder": "/vmfs/volumes/hx-ds1/packer-template"
  }]
}

I see the vm getting created., but while running post processor i am getting the below error


2017/11/16 01:42:10 packer-2: 2017/11/16 01:42:10 Writing VMX to: /tmp/packer-vmx652966173/packer-test1.vmx
2017/11/16 01:42:10 ui: ==> vmware-iso: Cleaning VMX prior to finishing up...
2017/11/16 01:42:10 ui:     vmware-iso: Unmounting floppy from VMX...
2017/11/16 01:42:10 packer-2: 2017/11/16 01:42:10 Deleting key: floppy0.present
2017/11/16 01:42:10 ui:     vmware-iso: Detaching ISO from CD-ROM device...
2017/11/16 01:42:10 ui:     vmware-iso: Disabling VNC server...
2017/11/16 01:42:10 packer-2: 2017/11/16 01:42:10 Writing VMX to: /tmp/packer-vmx652966173/packer-test1.vmx
2017/11/16 01:42:10 ui: ==> vmware-iso: Skipping export of virtual machine (export is allowed only for ESXi and the format needs to be specified)...
2017/11/16 01:42:10 packer-2: 2017/11/16 01:42:10 opening new ssh session
2017/11/16 01:42:10 packer-2: 2017/11/16 01:42:10 starting remote command: vim-cmd vmsvc/power.getstate 107
2017/11/16 01:42:11 ui: ==> vmware-iso: Keeping virtual machine registered with ESX host (keep_registered = true)
2017/11/16 01:42:11 packer-2: 2017/11/16 01:42:11 opening new ssh session
2017/11/16 01:42:11 packer-2: 2017/11/16 01:42:11 starting remote command: ls -1p /vmfs/volumes/hx-ds1/output-vmware-iso
2017/11/16 01:42:11 [INFO] (telemetry) ending vmware-iso
2017/11/16 01:42:11 ui: ==> vmware-iso: Running post-processor: vsphere-template
2017/11/16 01:42:11 [INFO] (telemetry) Starting post-processor vsphere-template
2017/11/16 01:42:11 ui:     vmware-iso (vsphere-template): Waiting 10s for VMware vSphere to start
2017/11/16 01:42:21 ui:     vmware-iso (vsphere-template): Choosing datacenter...
2017/11/16 01:42:21 ui:     vmware-iso (vsphere-template): Creating or checking destination folders...
2017/11/16 01:42:21 ui:     vmware-iso (vsphere-template): Creating folder: vmfs
2017/11/16 01:42:21 ui error: ==> vmware-iso (vsphere-template): ServerFaultCode: The operation is not supported on the object.
2017/11/16 01:42:21 [INFO] (telemetry) ending vsphere-template
2017/11/16 01:42:21 [INFO] (telemetry) found error: ServerFaultCode: The operation is not supported on the object.
2017/11/16 01:42:21 Deleting original artifact for build 'vmware-iso'
2017/11/16 01:42:21 packer-2: 2017/11/16 01:42:21 opening new ssh session
2017/11/16 01:42:21 packer-2: 2017/11/16 01:42:21 starting remote command: rm -rf /vmfs/volumes/hx-ds1/output-vmware-iso
2017/11/16 01:42:21 ui error: Build 'vmware-iso' errored: 1 error(s) occurred:

* Post-processor failed: ServerFaultCode: The operation is not supported on the object.
2017/11/16 01:42:21 Builds completed. Waiting on interrupt barrier...
2017/11/16 01:42:21 machine readable: error-count []string{"1"}
2017/11/16 01:42:21 ui error:
==> Some builds didn't complete successfully and had errors:

Any idea why this is happening ..? I am using ip of an esxi running 6.0 managed by vcenter 6.0 

Please provide assistance here.

Shan

Alvaro Miranda Aguilera

unread,
Nov 16, 2017, 12:03:33 PM11/16/17
to packe...@googlegroups.com
Hello

does this path exist?

/vmfs/volumes/hx-ds1/packer-template 

?
it seems is trying to crearte some path that is failing

2017/11/16 01:42:21 ui:     vmware-iso (vsphere-template): Creating folder: vmfs
2017/11/16 01:42:21 ui error: ==> vmware-iso (vsphere-template): ServerFaultCode: The operation is not supported on the object.


do you have a vCenter server?

?


--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/8c8da37b-b1a3-4876-b629-ade329a6203b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Shankar Bala

unread,
Nov 16, 2017, 12:44:55 PM11/16/17
to Packer
Hi

Path /vmfs/volumes/hx-ds1 exists but not /vmfs/volumes/hx-ds1/packer-template..i thought it will create if it doesnt exist.

shan

Shankar Bala

unread,
Nov 17, 2017, 3:58:27 PM11/17/17
to Packer

Anybody experienced this issue ?..esxi is part of vcenter 6.0

shan
On Thursday, November 16, 2017 at 7:56:23 AM UTC-8, Shankar Bala wrote:

rsjo...@gmail.com

unread,
Nov 18, 2017, 12:40:59 PM11/18/17
to Packer
Just to be sure: Are you targeting a vCenter server and not an ESXi host directly?

{
   
"type": "vsphere-template",
   
"host": "<vcenter ip>",

   
"insecure": true,
   
"datacenter": "ha-datacenter",

   
"username": "admini...@vsphere.local",
   
"password": "<vc admin password>",
   
"folder": "/Templates"
}

the folder should be from the root of your datacenter construct in vCenter. My "Templates" folder is directly underneath my datacenter as an example.

Shankar Bala

unread,
Nov 19, 2017, 12:33:06 PM11/19/17
to packe...@googlegroups.com
Hi

I am targetting vcenter only..i have my own datacenter..datacenter have to point to "ha-datacenter" or my own datacenter ?

Shankar

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/AsS7nzDYCCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/bc1ae57f-fdaa-4098-9567-ffa70fe3e689%40googlegroups.com.

rsjo...@gmail.com

unread,
Nov 20, 2017, 6:08:38 AM11/20/17
to Packer
you have to change all the values to fit your own environment. So if your datacenter construct in vCenter is called "MyDatacenter" then enter "MyDatacenter".

if you can share a screenshot of your vCenter inventory (Host view) i can verify the values.


On Sunday, November 19, 2017 at 6:33:06 PM UTC+1, Shankar Bala wrote:
Hi

I am targetting vcenter only..i have my own datacenter..datacenter have to point to "ha-datacenter" or my own datacenter ?

Shankar
On Sat, Nov 18, 2017 at 9:40 AM, <rsjo...@gmail.com> wrote:
Just to be sure: Are you targeting a vCenter server and not an ESXi host directly?

{
   
"type": "vsphere-template",
   
"host": "<vcenter ip>",
   
"insecure": true,
   
"datacenter": "ha-datacenter",

   
"username": "admini...@vsphere.local",
   
"password": "<vc admin password>",
   
"folder": "/Templates"
}

the folder should be from the root of your datacenter construct in vCenter. My "Templates" folder is directly underneath my datacenter as an example.

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/AsS7nzDYCCk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.

Shankar Bala

unread,
Nov 21, 2017, 7:58:15 PM11/21/17
to packe...@googlegroups.com
Hi

Thanks for your help..somehow "administrator" user on vcenter didnt work ..as it was giving error "permission denied"..i have to create another user and give admin privileges and then it worked.

I have one question ..since I have this vm template now on my dev vcenter, i would like to copy that template to a different vcenter on my production network..

can packer or any other tool available to do this task ?

any suggestions would help

Thanks 
Shankar

To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/4bc65cc0-91db-44df-a6af-270a976ab39f%40googlegroups.com.

Alvaro Miranda Aguilera

unread,
Nov 22, 2017, 3:47:33 AM11/22/17
to packe...@googlegroups.com
Hello

You could use packer to upload the VM to a different vcenter?

Or you could use the  post-processor shell to run commands from the command line.

There is a tool called ovftool and there is other called govc that can do operations like the one you want.

As time permits have a look at those.

Alvaro




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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAG6uczU1CUST7Ei-a40QzXWUYfKOb1mJQM%3DDejwfwOUeqOveyQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages