I created a workflow using the VAPI plugin to assign vSphere tags to a VC:VirtualMachine object.
You will need to import the package, then configure VAPI with your vCenter endpoints by following these instructions:
1 – Run the Import VAPI metamodel workflow
2 – Run the Add VAPI endpoint workflow
Both workflows take the same inputs, but you must run the workflows in that order. Screen shot of inputs as follows:
Once you have configured your VAPI endpoints, download the following package from github
Import the package and then the following workflows and actions.
Run the Add tag to VC vm workflow (highlighted in the package screen shot above), and as long as you have configured VAPI endpoints, you can add vSphere Tags and vSphere Categories to a VC:VirtualMachine object.
- The vCenter Virtual Machine is the VC:VirtualMachine object
- The VAPI Endpoint drop down list should contain all your VAPI endpoints
- The Create new Tag Category allows you to create a new Category
- The Tag Category displays existing tag categories configured on your VAPI Endpoint
- The Tag Name is the name of the tag you wish to create
- The Tag description is the description and is optional
Code is more of an example, as I found the OOTB VAPI plugins for tags pretty limited. You can move the input parameters to attributes as desired and pass in values for the tag name using maybe an API call to a SNOW or CMDB to get values for your tag name.
Any issues, send in a comment.