// Module included in the following assemblies:
//
// * windows_containers/enabling-windows-container-workloads.adoc

:_mod-docs-content-type: PROCEDURE
[id="installing-wmco-using-cli_{context}"]
= Installing the Windows Machine Config Operator using the CLI

You can use the OpenShift CLI (`oc`) to install the Windows Machine Config Operator (WMCO).

[NOTE]
====
Dual NIC is not supported on WMCO-managed Windows instances.
====

.Procedure

. Create a namespace for the WMCO.

.. Create a `Namespace` object YAML file for the WMCO. For example, `wmco-namespace.yaml`:
+
[source,yaml]
----
apiVersion: v1
kind: Namespace
metadata:
  name: openshift-windows-machine-config-operator <1>
  labels:
    openshift.io/cluster-monitoring: "true" <2>
----
<1> It is recommended to deploy the WMCO in the `openshift-windows-machine-config-operator` namespace.
<2> This label is required for enabling cluster monitoring for the WMCO.

.. Create the namespace:
+
[source,terminal]
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
[source,terminal]
----
$ oc create -f wmco-namespace.yaml
----

. Create the Operator group for the WMCO.

.. Create an `OperatorGroup` object YAML file. For example, `wmco-og.yaml`:
+
[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: windows-machine-config-operator
  namespace: openshift-windows-machine-config-operator
spec:
  targetNamespaces:
  - openshift-windows-machine-config-operator
----

.. Create the Operator group:
+
[source,terminal]
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
[source,terminal]
----
$ oc create -f wmco-og.yaml
----

. Subscribe the namespace to the WMCO.

.. Create a `Subscription` object YAML file. For example, `wmco-sub.yaml`:
+
[source,yaml, subs="attributes+"]
----
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: windows-machine-config-operator
  namespace: openshift-windows-machine-config-operator
spec:
  channel: "stable" <1>
  installPlanApproval: "Automatic" <2>
  name: "windows-machine-config-operator"
  source: "redhat-operators" <3>
  sourceNamespace: "openshift-marketplace" <4>
----
<1> Specify `stable` as the channel.
<2> Set an approval strategy. You can set `Automatic` or `Manual`.
<3> Specify the `redhat-operators` catalog source, which contains the `windows-machine-config-operator` package manifests. If your {product-title} is installed on a restricted network, also known as a disconnected cluster, specify the name of the `CatalogSource` object you created when you configured the Operator LifeCycle Manager (OLM).
<4> Namespace of the catalog source. Use `openshift-marketplace` for the default OperatorHub catalog sources.

.. Create the subscription:
+
[source,terminal]
----
$ oc create -f <file-name>.yaml
----
+
For example:
+
[source,terminal]
----
$ oc create -f wmco-sub.yaml
----
+
The WMCO is now installed to the `openshift-windows-machine-config-operator`.

. Verify the WMCO installation:
+
[source,terminal]
----
$ oc get csv -n openshift-windows-machine-config-operator
----
+
.Example output
[source,terminal]
----
NAME                                    DISPLAY                           VERSION   REPLACES   PHASE
windows-machine-config-operator.2.0.0   Windows Machine Config Operator   2.0.0                Succeeded
----
