# Enroll Baremetal Nodes

## Eroll baremetal nodes

### Enable node's IPMI

Baremetal servers are required to have an IPMI interface. Follow instructions [here](https://www.dell.com/support/manuals/sv-se/idrac9-lifecycle-controller-v3.0-series/idrac_3.00.00.00_ug/configuring-ipmi-over-lan-using-racadm?guid=guid-e84fe7b0-1d24-470d-a09a-2e2d009bc0bb\&lang=en-us) for iDRAC to enable IPMI over LAN for Dell servers. Make sure you set them to administrator mode.

Verify IPMI is enabled in administrator mode.

```
$ ssh expeca@192.168.0.4
Password: 
racadm>>racadm get iDRAC.IPMILan.Enable        
[Key=iDRAC.Embedded.1#IPMILan.1]
Enable=Enabled
racadm>>racadm get iDRAC.IPMILan.PrivLimit
[Key=iDRAC.Embedded.1#IPMILan.1]
PrivLimit=4
```

### Enable PXE on a network interface

On the Baremetal nodes, at least one of the registered network interfaces (those interfaces that are mentioned during the enrollment) must be PXE capable and connected to the tenants switch. PXE capabality of a network intrerface should be enabled from BIOS settings. This interface gets an IP from ironic provisioning network during the netboot.

### Enroll baremetal node

After running the instructions at [chameleoncloud.gitbook.io/chi-in-a-box/setup-guides/production-baremetal/quickstart](https://chameleoncloud.gitbook.io/chi-in-a-box/setup-guides/production-baremetal/quickstart), you can enroll baremetal nodes using Doni as follows

```
[
  {
    "name": "mobile-core",
    "hardware_type": "baremetal",
    "properties": {
      "cpu_arch": "x86_64",
      "baremetal_capabilities": {"boot_mode": "uefi"},
      "node_type": "mobile-code-class",
      "interfaces": [
          {
              "mac_address": "5c:6f:69:63:06:b0",
              "name": "NIC.Integrated.0:BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller",
              "switch_id": "a0:f8:49:f7:89:d1",
              "switch_info": "tenant-switch",
              "switch_port_id": "te2/0/1"
          },
          {
              "mac_address": "5c:6f:69:63:06:b1",
              "name": "NIC.Integrated.1:BCM57412 NetXtreme-E 10Gb RDMA Ethernet Controller",
              "switch_id": "a0:f8:49:f7:89:d1",
              "switch_info": "tenant-switch",
              "switch_port_id": "te2/0/2"
          }
      ],
      "ipmi_username": "expeca",
      "ipmi_password": "expeca",
      "ipmi_terminal_port": 30139,
      "management_address": "192.168.0.4"
    }
  }
]
```

Import the baremetal node

```
openstack hardware import --file baremetal.json
```

NOTE: Make sure you select at least one neutron dhcp network during the instance launch. Otherwise, openstack does not find a way to setup the node.

### Troubleshoot

https://adam.younglogic.com/2021/09/debugging-a-clean-failure-in-ironic/

Sometimes due to an error, IPMI gets locked. Clean all reservations and baremetal nodes from Openstack and reset the server's IPMI

```
ssh expeca@192.168.0.4
racadm>>racadm racreset soft
RAC reset operation initiated successfully. It may take a few
 minutes for the RAC to come online again.
```

Make sure you delete the node.

```
openstack baremetal node list
openstack baremetal node delete
```

Reset iDRAC and when it shows up in `openstack baremetal node list` delete it again.

Power on all the devices.

```bash
$ ipmitool -I lanplus -H 192.168.0.4  -L ADMINISTRATOR -U expeca -R 12 -N 5 -P expeca chassis power status

```

```bash
$ ipmitool -H 192.168.0.4 -U expeca -I lanplus -P expeca chassis power cycle
Set Chassis Power Control to Cycle failed: Command not supported in present state
```

```bash
$ ipmitool -H 192.168.0.2 -U expeca -I lanplus -P expeca chassis power on
Chassis Power Control: Up/On
```

```bash
$ ipmitool -H 192.168.0.4 -U expeca -I lanplus -P expeca sol info
```

### Enable Console

Make sure the ipmitool-shellinabox console interface is enabled, for example:

```
[DEFAULT]
enabled_console_interfaces = ipmitool-shellinabox,no-console
```

After node enrollment run

```
openstack baremetal node <node-uuid> --console-interface ipmitool-shellinabox
openstack baremetal node console enable <node-uuid>
```

Check whether the console is enabled, for example:

```
openstack baremetal node validate <node-uuid>
```

Check the web console address

```
openstack baremetal node console show <node-uuid>
+-----------------+-------------------------------------------------------------+
| Field           | Value                                                       |
+-----------------+-------------------------------------------------------------+
| console_enabled | True                                                        |
| console_info    | {'type': 'shellinabox', 'url': 'http://10.20.111.11:30139'} |
+-----------------+-------------------------------------------------------------+
```

Although this is the internal network, the console could be reach via `http://10.0.87.254:30139/`.

More info [docs.openstack.org/ironic/queens/admin/console.html](https://docs.openstack.org/ironic/queens/admin/console.html)

## Delist baremetal nodes

```
openstack hardware delete <hardware-uuid>
openstack baremetal node delete <node-uuid>
```
