packer centos7 kickstart from spacewalk uding vmware-iso builder on vcenter

1,019 views
Skip to first unread message

Anil Dasmala

unread,
Aug 29, 2016, 4:18:25 AM8/29/16
to Packer
Hi guys,

I'm new to packer.
Im on centos 7.2, Packer v0.10.1
My ultimate goal is to spinup a centos vm on vcenter with vmware-iso builder.
using a custom minimal iso which has kick-start profiles to install  from spacewalk.
i.e packer -> bootiso-to-kickstart-from-spacewalk ->bootcommand referrign kickstart profile -> install vm on vcenter

Here is my initial json file. but im gettign below error when runnign packer build on my json file, any ideas why its failing?
so the builder section builds an image which can be in turn transferred to vcenter in post-processing? or how does the process actually work.
Thanks in advance.

2016/08/26 04:40:11 ui error: Build 'vmware-iso' errored: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:
* exec: "vmware": executable file not found in $PATH
* exec: "vmware": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH
* exec: "vmplayer": executable file not found in $PATH

json file
==========
{
  "variables": {
    "ssh_name": "root",
    "ssh_pass": "xxxxxx",
    "hostname": "packer-test"
  },

  "builders": [
    {
      "type": "vmware-iso",
      "iso_url": "http://127.0.0.1:8000/centos-min-custom-boot.iso", 
      "iso_checksum_type": "none",
      "ssh_username": "{{user `ssh_name`}}",
      "ssh_password": "{{user `ssh_pass`}}",
      "shutdown_command": "echo {{user `ssh_pass`}} | sudo -S shutdown -P now",
      "boot_command": [
        "<tab> linux nameserver=x.x.x.x gateway=x.x.x.x ip=x.x.x.x ks=http://spacewalkhost/ks/cfg/org/1/label/centos70_x86_64_MIN netmask=255.255.255.0 --<enter>"
      ]
    }
  ]
}

Alvaro Miranda Aguilera

unread,
Aug 29, 2016, 4:25:03 AM8/29/16
to packe...@googlegroups.com
Hello

If I understand this correctly, you want to build on a remote ESXi server.

As you haven't defined the remote host, its trying to build a local vmware vm ie Workstation/Fusion.

Check all the remote_<*> in the documentation, especially remote_host


Thanks
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/fb95e989-5c91-4662-9e9c-56e7f238f683%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Anil Dasmala

unread,
Aug 29, 2016, 6:12:05 AM8/29/16
to Packer
Hey Alvaro,

Thank you so much for the quick reply. yes you are right, now I got past that error.
btw do you think the way im planning vm provisioning i.e is  boot from minimal iso to kickstart from spacewalk supported?,
or should I use floppy_files for specifying the kickstart file?
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--

Alvaro Miranda Aguilera

unread,
Aug 29, 2016, 3:46:21 PM8/29/16
to packe...@googlegroups.com
the spacewalk is a known webserver so you will be using it as http for kickstart and potentially for a internal yum repo.

it should work, just test the ks manyally first, and then try to make packer to automate that.

If you use a minimal cd/dvd, you need to add to the kickstart the install media as new repo, copy the content of a full DVD with metadata and test.

If you go with a full dvd, it will be only uploaded once to the vmstore, and you can just use none for the checksum check of the same to make the process to go faster.

You have lots of options, so my suggestion will be try couple and see what feels more natural.

Thanks
Alvaro.

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/aedb995e-be21-46d8-ac4e-25ecca69f933%40googlegroups.com.

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



--

Anil Dasmala

unread,
Aug 30, 2016, 1:08:07 AM8/30/16
to Packer
ok thank you. yeah I have the repos defined in the kickstart file.
I'l post the results, right now I'm working on getting ssh access to esxi host discussing roles required to provision vm with vmware admins.



--
Message has been deleted

Alvaro Miranda Aguilera

unread,
Sep 2, 2016, 2:18:36 PM9/2/16
to packe...@googlegroups.com

On Thu, Sep 1, 2016 at 9:30 AM, Anil Dasmala <dani...@gmail.com> wrote:
vmxnet3

Hello

What he did is a new file.go that you can use to patch packer and build a new binary.

I think will be easier to ask him for a build version (binary) to test.

Other option is create a custom iso / initrd



Can you share your packer templates and scripts?

I have an ESX 5.5 where I can test 


--

Anil Dasmala

unread,
Sep 6, 2016, 6:36:55 AM9/6/16
to Packer
Hi Alvaro,

Thanks for the info.
Finally I found another way to get past this issue of vmxnet3. create-vm.json attached.
(Note : in json file i have to set "ethernet0.virtualDev": "e1000" , otherwise packer build fails.)

After running packer build myjsonfile and i see VM getting registered on esx in debug text, I'm using vsphere powercli to modify the network adapter to vmxnet3 type online.
get-vm packer-vm | get-networkadapter|set-networkadapter -networkname "vlan2"   -type vmxnet3 -connected:$true -confirm:$false

I tested on centos7, the vmxnet3 driver is gettign loaded only after shutdown and power on, (if I just reboot instead of shutdown first time e1000 driver loaded).

Thanks again Alvaro, your help is much appreciated.
create-vm.json

Alvaro Miranda Aguilera

unread,
Sep 6, 2016, 9:11:20 AM9/6/16
to packe...@googlegroups.com
Hello

This is my suggestion based on what I would do if I was in your situation.

Replace:
      "vmx_data": {
        "virtualHW.version": "9",
        "ethernet0.startConnected": "TRUE",
        "ethernet0.present": "TRUE",
        "ethernet0.virtualDev": "e1000",
        "ethernet0.networkName": "vlan2",
        "ethernet0.addressType": "generated",
        "ethernet0.displayName": "vlan2",
        "ethernet0.present": "TRUE",
        "memsize": "1024",
        "numvcpus": "1",
        "cpuid.coresPerSocket": "1",
        "scsi0:0.present": "TRUE",
        "scsi0:0.redo": "",
        "ide0:0.present": "FALSE"
      }

To ethernet1.

Just let packer to create ethernet0.

When the machine starts, probably won't see eth0 due the lack of drivers, so the ks should work as is.

as part of the provisioning, in packer you can install vmware tools, then:

When you finish to install, put on /etc/sysconfig/network-scripts/ifcfg-eth0 and eth1, for dhcp on boot

At some point you can/could/should export the VM without nics or 1/2 nics etc and will work in all the cases.

my 2 cents

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/f1ecf513-a684-48f5-af7f-e4ccf2dc6d80%40googlegroups.com.

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



--

Anil Dasmala

unread,
Sep 6, 2016, 9:43:37 AM9/6/16
to Packer
ok thank you.

Two minor issues i have are,
1.ssh not connecting even after vm gets installed through kickstart , reboots and shows login prompt in console and
2.if i cancel the packer build vm gets unregistered even after setting keep_registered to true
can you talk about that?,
I've set text based kickstart install.

This is what i've got in Debug mode :

2016/09/06 09:17:26 packer: Stderr:
2016/09/06 09:17:31 ui error: ==> vmware-iso: Timeout waiting for SSH.
==> vmware-iso: Timeout waiting for SSH.
2016/09/06 09:17:31 packer: 2016/09/06 09:17:31 opening new ssh session
2016/09/06 09:17:31 packer: 2016/09/06 09:17:31 [DEBUG] SSH wait cancelled. Exiting loop.
2016/09/06 09:17:31 packer: 2016/09/06 09:17:31 starting remote command: vim-cmd vmsvc/power.getstate 42
2016/09/06 09:17:32 packer: 2016/09/06 09:17:32 remote command exited with '0': vim-cmd vmsvc/power.getstate 42
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--

Rickard von Essen

unread,
Sep 6, 2016, 2:45:15 PM9/6/16
to packe...@googlegroups.com

Do you have a dhcp server in spacewalk, if so you need to fix the IP lease an set the ssh_host in packer.
What's the point of adding space walk, I don't see that it will add any value.


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/cde8dcc3-bf4e-4362-8d90-e42d974a7ed6%40googlegroups.com.

Anil Dasmala

unread,
Sep 7, 2016, 1:03:05 AM9/7/16
to Packer
@Rickard
No DHCP, need static ips to be assigned.
Well , my use case is a bit different. I'm using packer just as a tool to create vm and automate the boot command input for rhel/centos based installs from spacewalk.
We dont prefer cloning of these distributions for historical reasons. We use ansible for post deployment tasks.
Reply all
Reply to author
Forward
0 new messages