Save to My DOJO
If you have spent any significant amount of time managing vSphere environments, I’m sure you created your fair share of VM templates. I also bet, that you uploaded a number of ISO files to one or more datastores but you always forget which datastore you placed them on. Sounds familiar?
Whatever the case may be, this setup can quickly get out of hand as environments grow larger. Starting with vSphere 6, VMware is introducing Content Libraries, a solution to this problem albeit one that can be improved upon for reasons I’ll soon explain.
Quoting from VMware documentation;
Content libraries are container objects for VM templates, vApp templates, and other types of files. vSphere administrators can use the templates in the library to deploy virtual machines and vApps in the vSphere inventory. Sharing templates and files across multiple vCenter Server instances in same or different locations brings out consistency, compliance, efficiency, and automation in deploying workloads at scale.
The good and the iffy!
The primary benefit of a content library is that it provides a central repository to which you can upload ISOs, VM and vApp templates, scripts and other file types that might come in handy. Once a library has been created and populated, you have the option to publish it externally making it accessible to other vCenter Server instances via a JSON subscription URL. This feature is a great thing as it presents the same repository view to any vCenter Server instance it has been published to. The second best feature is the ability to deploy virtual machines from any template stored in the library.
Cloning a library item to the same library or to an external one, is yet another feature. You can also clone a VM to a template directly to a library, as shown in Figures 1a and b.
The iffy bits are;
(a) You won’t be able to customize Templates or vApps uploaded to a library. These exist purely as OVF files.
(b) You won’t be able to mount an ISO image stored in a library. This means you have to stick with the old way of doing things; store ISOs on local disk or a datastore.
Library Types
There are two types of libraries; a local library and a subscribed library.
A local library is created by designating a shared folder on the same Windows Server where vCenter Server is installed. If you’re running vCenter Server Appliance (vCSA), an NFS mount point is used instead. A library can also be created on a datastore.
For this post, I opted to create a Windows share. I assigned everyone write permissions both on the share and folder, something I usually avoid doing for security reasons. The permission are required so users will be able to upload to the library.
Once the local library is created, you can choose to have it published externally. As already mentioned, this makes the local library accessible from other vCenter Server instances which is why this is referred to as a subscribed library. When a local library is published, you also have the option to password protect it. By default, the vcsp local account is used. You have to specify the password set for vcsp when you subscribe to the library from other vCenter Server instances as per Fig. 2.
Creating a local content library
The following instructions and screenshots will take you through the process of setting up a local content library on vCenter Server for Windows. This steps are to be carried out using the vSphere Web client. For the progammatically inclined, you can use the Content Library api to create and manage content libraries using .NET, Java and Python. This is beyond the scope of this post, but the link provided should be a start if interested.
Figure 3 is to show you how libraries created on a datastore – marked in red – are listed in Datastore Browser as opposed to libraries residing in a Windows or NFS share.
Adding items to the library
After the library is created, you can start adding items to it. In general, you will probably be uploading ISO and OVF files, however it’s good to know that you can upload any file type if needed. OVF files are automatically placed under Templates. Other file types are instead placed under Other Types. In the next example, I’ve uploaded an ESXi 6.0 template, something I generally use to deploy nested environments from.
Deploying a VM from library
One of the benefits of content libraries is the ability to deploy a virtual machine directly from a template stored in a library.
To do this, simply locate the template from the library, right click on it and select New VM from this template as shown in Figure 4. It is then just a matter of following the deployment wizard. Specify a destination folder, the host where the VM will be deployed, the VM’s disk format, a datastore and finally the network (portgroup) for the VM.
Subscribing to a content library from vCenter
Publishing a local library externally allows you to subscribe to it from other vCenter Server instances. Here’s how.
Here as an example of a subscription link along with the JSON contents listed.
https://vcenter60qa.local/cls/vcsp/lib/2e182db2-2744-4e8f-8316-bd79b2a437fd/lib.json
Changing library settings
The settings for both local and subscribed libraries can be changed any time by clicking on the Settings tab while the given library is selected. This is shown in Fig. 5.
Conclusion
Concluding, have a look at the next video where I demonstrate how to:
- Create a local library
- Add an item to the library, in this case a template (OVF)
- Deploy a virtual machine from the item just added
Content libraries are a great way to organize templates, ISO images and other file types. It’s a pity that a few missing features such as the ability to mount an ISO from a library or customize library templates, don’t make content libraries a permanent solution to how templates and ISO images are handled in general. In all probability, these missing bits will be included with the next iteration of vSphere.
UPDATE: Since this article was written, vSphere 6.5 has been released. The missing features have indeed been addressed and included as predicted! Watch out this space for a new article discussing these latest editions.
[the_ad id=”4738″][the_ad id=”4796″]
Not a DOJO Member yet?
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!