// Module included in the following assemblies:
//
//* installing/Installing-vsphere-installer-provisioned-customizations.adoc [IPI]
//* installing/installing-vsphere.adoc [UPI]
//* installing/installing-vsphere-network-customizations.adoc [UPI]
//* installing/installing-restricted-networks-installer-provisioned-vsphere.adoc [IPI]
//* installing/installing-restricted-networks-vsphere.adoc [IPI]

:_mod-docs-content-type: PROCEDURE
[id="configuring-vsphere-regions-zones_{context}"]
= Configuring regions and zones for a VMware vCenter

You can modify the default installation configuration file, so that you can deploy an {product-title} cluster to multiple vSphere data centers.

The default `install-config.yaml` file configuration from the previous release of {product-title} is deprecated. You can continue to use the deprecated default configuration, but the `openshift-installer` will prompt you with a warning message that indicates the use of deprecated fields in the configuration file.

.Prerequisites
* You have an existing `install-config.yaml` installation configuration file.
+
[IMPORTANT]
====
You must specify at least one failure domain for your {product-title} cluster, so that you can provision data center objects for your VMware vCenter server. Consider specifying multiple failure domains if you need to provision virtual machine nodes in different data centers, clusters, datastores, and other components. To enable regions and zones, you must define multiple failure domains for your {product-title} cluster.
====
+
* You have installed the `govc` command line tool.
+
[IMPORTANT]
====
The example uses the `govc` command. The `govc` command is an open source command available from VMware; it is not available from Red{nbsp}Hat. The Red{nbsp}Hat support team does not maintain the `govc` command. Instructions for downloading and installing `govc` are found on the VMware documentation website.
====

.Procedure

. Create the `openshift-region` and `openshift-zone` vCenter tag categories by running the following commands:
+
[IMPORTANT]
====
If you specify different names for the `openshift-region` and `openshift-zone` vCenter tag categories, the installation of the {product-title} cluster fails.
====
+
[source,terminal]
----
$ govc tags.category.create -d "OpenShift region" openshift-region
----
+
[source,terminal]
----
$ govc tags.category.create -d "OpenShift zone" openshift-zone
----

. For each region where you want to deploy your cluster, create a region tag by running the following command:
+
[source,terminal]
----
$ govc tags.create -c <region_tag_category> <region_tag>
----

. For each zone where you want to deploy your cluster, create a zone tag by running the following command:
+
[source,terminal]
----
$ govc tags.create -c <zone_tag_category> <zone_tag>
----

. Attach region tags to each vCenter data center object by running the following command:
+
[source,terminal]
----
$ govc tags.attach -c <region_tag_category> <region_tag_1> /<data_center_1>
----

. Attach the zone tags to each vCenter cluster object by running the following command:
+
[source,terminal]
----
$ govc tags.attach -c <zone_tag_category> <zone_tag_1> /<data_center_1>/host/<cluster1>
----

. Change to the directory that contains the installation program and initialize the cluster deployment according to your chosen installation requirements.
+
.Sample `install-config.yaml` file with multiple data centers defined in a vSphere center

[source,yaml]
----
# ...
compute:
---
  vsphere:
      zones:
        - "<machine_pool_zone_1>"
        - "<machine_pool_zone_2>"
# ...
controlPlane:
# ...
vsphere:
      zones:
        - "<machine_pool_zone_1>"
        - "<machine_pool_zone_2>"
# ...
platform:
  vsphere:
    vcenters:
# ...
    datacenters:
      - <data_center_1_name>
      - <data_center_2_name>
    failureDomains:
    - name: <machine_pool_zone_1>
      region: <region_tag_1>
      zone: <zone_tag_1>
      server: <fully_qualified_domain_name>
      topology:
        datacenter: <data_center_1>
        computeCluster: "/<data_center_1>/host/<cluster1>"
        networks:
        - <VM_Network1_name>
        datastore: "/<data_center_1>/datastore/<datastore1>"
        resourcePool: "/<data_center_1>/host/<cluster1>/Resources/<resourcePool1>"
        folder: "/<data_center_1>/vm/<folder1>"
    - name: <machine_pool_zone_2>
      region: <region_tag_2>
      zone: <zone_tag_2>
      server: <fully_qualified_domain_name>
      topology:
        datacenter: <data_center_2>
        computeCluster: "/<data_center_2>/host/<cluster2>"
        networks:
        - <VM_Network2_name>
        datastore: "/<data_center_2>/datastore/<datastore2>"
        resourcePool: "/<data_center_2>/host/<cluster2>/Resources/<resourcePool2>"
        folder: "/<data_center_2>/vm/<folder2>"
# ...
----
