// This module is included in the following assemblies:
//
// * installing/installing_bare_metal/bare-metal-using-bare-metal-as-a-service.adoc

:_mod-docs-content-type: PROCEDURE
[id="bmo-creating-a-bare-metal-host-resource_{context}"]
= Creating a bare-metal host resource

[role="_abstract"]
To deploy a bare-metal host, you must create a `BareMetalHost` resource.

.Procedure

. Create a `BareMetalHost` custom resource (CR) file by running the following command:
+
[source,terminal]
----
$ vim bmaas-<name>-bmh.yaml
----
+
<name>::
    Replace `<name>` with the name of the bare-metal host.

. Edit the CR: 
+
[source,yaml]
----
apiVersion: metal3.io/v1alpha1
kind: BareMetalHost
metadata:
  name: bmaas-<name>
  namespace:  bmaas
spec:
  online: true
  bootMACAddress: <mac_addr>
  bmc:
    address: redfish-virtualmedia+<address>/redfish/v1/Systems/System.Embedded.1 
    credentialsName: bmaas-<num>-bmc-secret
----
+
<mac_addr>::
    Replace `<mac_addr>` with the MAC address of the first NIC on the bare-metal host.
<address>::
    Replace `<address>` with IP address or FQDN of the host.

. Apply the CR by running the following command:
+
[source,terminal]
----
$ oc apply -f bmaas-<name>-bmh.yaml
----

.Verification

* Check the `BareMetalHost` state by running the following command: 
+
[source,terminal]
----
$ oc get baremetalhost -n bmaas
----
+
The state progresses from *registering*, to *inspecting*, and finally to *available*.
