VMware {code} Community
Seimawn
Contributor
Contributor
Jump to solution

Personality

Is there any way to customize the personality of a vm by injecting data into its file system at creation phase?

For example,if you want to insert ssh keys, set configuration files, or store data that you want to retrieve from inside the vm.

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
stumpr
Virtuoso
Virtuoso
Jump to solution

Whatever process you are using to install your VM Guest OperatingSystem could be hooked to install files.  You'll need an operating system to copy files into a Guest Smiley Happy

If you need a file in there before the GuestOS boots up, you'll have to add it to your installation process.  If it's just a simple file copy (no registry or package installation steps), you could look into mounting the VMDK from the newly cloned/created VM and drop the files directly.  You'll need the VDDK (C/C++ library) or the vmdk mount tool (if it's still floating around). 

You could look into having a "file store VMDK" that you just add to a VM.  But you may or may not be able to see that file system without GuestOS modification.  The other option is to just setup a process and look for those files on first-run on an NAS share (NFS/FTP/HTTP).  You can easily add a first-run script to your template to wget files from a web cgi page ("Hey I'm VM blah, give me my SSH keys").

Reuben Stump | http://www.virtuin.com | @ReubenStump

View solution in original post

Reply
0 Kudos
5 Replies
stumpr
Virtuoso
Virtuoso
Jump to solution

If you're on vSphere 5.x or later, you can use GuestOperationsManager to copy file and run processes in guest.  Best part of this API call, is it uses the VMware Tools and can be done even with the VM not on the network (no NIC or network connectivity).

If you have a lot of large installations to do, you might want to consider putting them into the template (and then customizing if possible after deploy).  Or you can consider putting all the installation files into an ISO and mounting that.  Once mounted, you can then use GuestOps to run the installers or shell scripts to do the customization of your guest OS.  I've used this model to install MSSQL, vCenter, etc.

Others use Puppet or similar tools.  You can inject a puppet configuration file into the guest OS using GuestOps, then wait for the Puppet process to pick up the VM and apply it's configuration settings.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Seimawn
Contributor
Contributor
Jump to solution

We have a generic template we´re cloning. Then we want to inject personality files (text files) onto the new machine.

Do you have to wait until the cloning is done, or can you inject it while its cloning or specify it in some config param or so?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

You have to wait for the cloning to complete and the VM to boot up.  You'll need VMware Tools running to call the GuestOps methods.

Technically, it is possible to mount the VMDK and insert files and such while the VM is offline (or template).  But it'll be a lot more work and require tools that aren't really easy to grab anymore (such as the vmdk mounter).  Even then, you'll have to do work with the offline registry and such.  It was something I explored years ago, but it was just too much work and prone to more errors than doing post-provisioning 'patch-in' code.

Now, you can also bake your templates to call out for files or run some first-run script as well.  Finally, some customers have actually just done their own kickstart or RIS process into the VM to fully customize the GuestOS dynamically.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Seimawn
Contributor
Contributor
Jump to solution

Okej, I see Smiley Sad

But I create a VM instead of cloning. Is it possible then to create files on the VM before the "creation process" is finished?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Whatever process you are using to install your VM Guest OperatingSystem could be hooked to install files.  You'll need an operating system to copy files into a Guest Smiley Happy

If you need a file in there before the GuestOS boots up, you'll have to add it to your installation process.  If it's just a simple file copy (no registry or package installation steps), you could look into mounting the VMDK from the newly cloned/created VM and drop the files directly.  You'll need the VDDK (C/C++ library) or the vmdk mount tool (if it's still floating around). 

You could look into having a "file store VMDK" that you just add to a VM.  But you may or may not be able to see that file system without GuestOS modification.  The other option is to just setup a process and look for those files on first-run on an NAS share (NFS/FTP/HTTP).  You can easily add a first-run script to your template to wget files from a web cgi page ("Hey I'm VM blah, give me my SSH keys").

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos