Content Library has evolved quite a bit since its inception in vSphere 6.0. Some of that evolution has brought new ways to accomplish tasks as well as new features. One of the newest additions as of late is new cmdlets for Content Library management via PowerCLI, available in version 11.5.0.
This blog will guide you through working with Content Library to get a library set up, add items to the library, as well as remove a library item when no longer needed. I will cover each task from the UI or vSphere Client method. As an added bonus, tasks covered here in this post will link to the same tasks but from a PowerCLI perspective, covered by Kyle Ruddy over on the PowerCLI Blog. This way whether you are a fan of the running tasks from the vSphere Client or using PowerCLI, we have you covered.
Creating a Content Library
It is important to discuss vCenter Server permissions for Content Library. To be able to create a library the required privileges needed are ‘Content library.Create local library’ or ‘Content library.Create subscribed library’ on the vCenter Server node where you are creating the library. vCenter Server comes with a sample role ‘Content library administrator‘ that can be cloned or edited to suit the need.
Be sure to review and set the required permissions as highlighted below by navigating in the vSphere Client to Menu >> Administration >> Access Control/Roles. Clicking on the role name will display the Description, Usage, and Privileges of the role.
To create a library, begin by logging into the vSphere Client and then from the top Menu select Content Libraries.
Next, click the “+” (plus sign) to open the New Content Library wizard.
We will need to specify the Content Library Name and any required Notes. Next, select the vCenter Server that will manage the new library. Once the library Name and Notes have been entered, click Next to continue.
NOTE: If only one (1) vCenter Server is being used, no others will show in the list. This is also true if the vCenter Servers are not in Enhanced Linked Mode (ELM).
Here is where the Content Library setup and configuration take place. We can either set this library to be a Local Content Library or we can Subscribe to another library by providing the Subscription URL of that Published Library.
In this example we will choose; Local Content Library and we’ll also enable publishing by ticking the box Enable Publishing. Publishing the library’s contents will allow subscriber libraries to also pull in contents from the Publisher. Click Next to continue.
Select a storage location for the library’s contents. This can be vSphere datastore that exists in inventory or an SMB or NFS path to storage. In this example, a vSAN datastore is being used as the backing datastore for the Content Library. Choose the datastore and then click Next to continue.
NOTE: You can store your templates on an NFS storage that is mounted to the vCenter Server Appliance. After the create a new library operation is complete, the vCenter Server Appliance mounts the shared storage to the host OS.
Review the settings chosen for the Content Library before clicking Finish to complete.
When the wizard is done, the vSphere Client will show the details of the Content Library created. Click on the name of the Content Library to continue.
From here administrators can review the details of the Content Library. Easily review and access Storage or Publication information such as capacity/free space and Subscription URL, needed when subscribing to a published library.
Adding Items to Content Library
Now that Content Library is setup we can begin to add items. Content Library supports importing OVF and OVA templates, scripts, ISO images, certificates, etc. Keeping these items in a library allows them to be shared with other users across multiple vCenter Server instances. Templates stored in Content Library can be used to deploy new virtual machines and vApps. In this blog example, we will add a PowerCLI (.ps1) script to the local library.
By browsing back to the Content Library listing and finding the Publisher Library, we can now start to add content to the library.
Right click on Publisher Library and choose Import item to begin.
Select Local file and then click UPLOAD FILE to browse files for upload.
In this example, I am uploading a PowerCLI script (“My-New-Script.ps1”) to the Content Library. Select the desired file, click Open to continue.
Complete the details for Item Name & Notes before clicking IMPORT to upload the file to the library.
After the upload has completed, open the library to the Summary page. Click Other Types to view the newly uploaded PowerCLI script. Clicking on the file name will open the details screen.
The details screen displays the file Type, Size, Created (date), and Last Modified (date). We can also remove content from the library by clicking on the ACTIONS menu and selecting Delete.
Confirm the deletion of the selected library item, click OK to continue.
In this post, we covered the creation and setup of a Content Library that will be used to Publish content to other Subscriber libraries. We learned how to Add and Remove items from Content Library and also discussed required permissions in vCenter Server to work with creating and/editing the Content Library. Stay tuned for future posts on Content Library in vSphere.
To learn more about Content Library, please review these resources:
- What’s New for Content Library Management
- Creating a Content Library (vSphere 6.7 Walkthrough)
- Using Content Library to Sync VM Templates (vSphere 6.7 Walkthrough)
- Content Library Privileges
- Create a Library (vSphere 6.7)
- Import Items to a Content Library
- Content Library Management with PowerCLI 11.5