// Module included in the following assemblies:
//
// * machine_management/creating_machinesets/creating-machineset-vsphere.adoc
// * machine_management/control_plane_machine_management/cpmso_provider_configurations/cpmso-config-options-vsphere.adoc

:_mod-docs-content-type: PROCEDURE
[id="machine-api-vmw-add-tags_{context}"]
= Adding tags to machines by using machine sets

[role="_abstract"]
To ensure that your cluster remains scalable and resilient, you can use a `MachineSet` object and machine health checks to automate the provisioning and repair of nodes. 

{product-title} adds a cluster-specific tag to each virtual machine (VM) that it creates. The installation program uses these tags to select the VMs to delete when uninstalling a cluster.

In addition to the cluster-specific tags assigned to VMs, you can configure a machine set to add up to 10 additional {vmw-short} tags to the VMs it provisions.

.Prerequisites

* You have access to an {product-title} cluster installed on {vmw-short} using an account with `cluster-admin` permissions.
* You have access to the VMware vCenter console associated with your cluster.
* You have created a tag in the vCenter console.
* You have installed the {oc-first}.

.Procedure

. Use the vCenter console to find the tag ID for any tag that you want to add to your machines:

.. Log in to the vCenter console.

.. From the *Home* menu, click *Tags & Custom Attributes*.

.. Select a tag that you want to add to your machines.

.. Use the browser URL for the tag that you select to identify the tag ID.
+
.Example tag URL
[source,text]
----
https://vcenter.example.com/ui/app/tags/tag/urn:vmomi:InventoryServiceTag:208e713c-cae3-4b7f-918e-4051ca7d1f97:GLOBAL/permissions
----
+
.Example tag ID
[source,text]
----
urn:vmomi:InventoryServiceTag:208e713c-cae3-4b7f-918e-4051ca7d1f97:GLOBAL
----

. In a text editor, open the YAML file for an existing machine set or create a new one.

. Edit the following lines under the `providerSpec` field:
+
[source,yaml]
----
tag::compute[]
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
end::compute[]
tag::controlplane[]
apiVersion: machine.openshift.io/v1
kind: ControlPlaneMachineSet
end::controlplane[]
# ...
spec:
  template:
    spec:
      providerSpec:
        value:
          tagIDs:
          - <tag_id_value>
# ...
----
+
where
+
--
`spec.template.spec.providerSpec.value.tagIDs`:: Specifies a list of up to 10 tags to add to the machines that this machine set provisions. Replace `<tag_id_value>` with the tag that you want to add to your machines. For example, `urn:vmomi:InventoryServiceTag:208e713c-cae3-4b7f-918e-4051ca7d1f97:GLOBAL`.
--
