vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.02k stars 928 forks source link

providing input while installing ISO in VM #333

Open thinksabin opened 7 years ago

thinksabin commented 7 years ago

Hi,

I want to do something like this:

install new custom ISO which ask options, and based upon the option selected install appropriate OS type on the virtual machine. How can i trigger keyboard action or say provide input for options while automating the ISO installation in the virtual machine? If i just automate the ISO installation in the virtual machine, the installation process will ask for choices to make prior before installing the base operating system (Ubuntu) and whole automation will stop. Is there any way to resolve this kind of issues by using appropriate vmware api ?

thanks

thanks

asonar commented 7 years ago

You can create Vm using pyvmomi, you can find sample code in git. For installation, I would say, explore unattended installation process e.g ks.cfg for RHEL and equivalents for windows and other linux distro's as well. Put these two things in simple scripts to automate whole process.

thinksabin commented 7 years ago

thanks for reply, the case here is the options pops up before installation of operating system, i.e ubuntu, so we cant use the unattended installation process of ubuntu. We to need to select the options and finally the os installation start at that time may be we can use unattended installation as you mentioned.

I was wondering if there is any api module that would trigger keyboard or mouse action in vm.

asonar commented 7 years ago

I am pretty sure u can install Ubuntu without any single intervention. You just need to find a way to do it. Quick google search will give you many ways to do it.

thinksabin commented 7 years ago

unattended installation for ubuntu might work for me to install without any single intervention but as i said, my iso installation got a layer before OS installation that will ask for which type of OS to install, I need to trigger options there, without triggering options in that phase, there wont be any installation carried out. Lets say the option is to installation Ubuntu or Suse, and I need to trigger keyboard action saying Ubuntu and then unattended installation for ubuntu will get carried out which might not be an issue. thanks for reply

ellieayla commented 7 years ago

Does your ISO installation layer before OS installation support some kickstart-like automation? That's definitely the recommended approach.

If you really want to type keys at a VM, the MKS functionality is VNC with some extensions. I hear the "webmks" variant degrades gracefully to plain-VNC, with the VNC username/password being a vim.VirtualMachine.Ticket string from VirtualMachine.AcquireTicket("webmks"). Or "mks" with an mks auth proxy.

edit: I have no examples of these being used beyond what's in the links above.

thinksabin commented 7 years ago

thanks for reply, alanjcastonguay. No the ISO installation layer doesnt support kickstart-like automation. Its bash script running on the live iso providing the dialogue menu box made in bash script. and selecting options will trigger another script located in like /usr/share/abc/abc.sh that will do iso installation or other. Can you provide some sample codes using vim.VirtualMachine.Ticket ? And is there any way i can execute abc.sh directly through UUID of virtual machine or hostname of virtual machine? This might also work for me.

thanks again.