What are tags?
For those of you just starting with tags, tags are a relatively new function to allow users to add metadata to objects allowing those objects to be categorized. This means that by adding tags, objects in your virtual environment can be more sortable/searchable.
What would I use tags for?
I’ve seen tags used for things such as classifying the Operating System running on VM’s, specifying who is responsible for each VM, Tier of Storage, adding the Line of Business, specifying time windows for reboots and backups, policies, business critical applications, etc. The list goes on and on. The ability is there to allow flexibility on the users side to leverage these capabilities to make their jobs easier.
Previous to 5.8 we had implemented ‘filtering by tags’ in the following get-cmdlets:
As an example, If I had tagged all of the virtual machines I took care of in an environment, I could quickly see my list of machines by using the –Tag parameter on the Get-VM cmdlet.
You can see how this can become beneficial to be able to filter a get- command by a tag.
Well that’s great, but what’s new in 5.8r1?
Glad you asked! One of the great features of the latest PowerCLI version is that we have expanded the objects that can use the filtering by tag parameter.
In addition to the previous get- cmdlets with the ‘filter by tag’ capability, we’ve added this funcionality now to the following cmdlets as well:
This in turn will allow administrators another way to quickly sort through even more objects in their virtual infrastructure using metadata tags.
Can you show me any examples?
Of course! if we take a quick look at the tags in my test environment, ( get-tag | ft –AutoSize ) we can see I’m using three categories (“Owner, SME Contact, and Tier”). These tags have been setup so that I can know the criticality of different objects, as well as who to turn to if there is a question/problem with one of them.
If we take a quick look at my clusters using the get-cluster command, we can see that there are four clusters in my environment. However, if I add my –Tag filter for ‘Gold’ or my highest priority clusters, my two VSAN clusters are the only objects returned.
Same thing goes with my datacenters. I cannot tell which of my datacenters are being used for dev/test by their names when running the get-datacenter command. However, by adding the –Tag parameter I am able to filter my results down to see just that.
If you are now sold on using tags but haven’t started implementing them in your environment yet, I would suggest you take a few minutes and read Alan Renouf’s post “Using vSphere Tags with PowerCLI” which should help get you up and running quickly.