# irrigate-ceph

This cookbook provides functionality to provision Ceph cluster hosts.

The cookbook installs the pre-requisite packages for a Ceph host and configures the cluster's public SSH key to enable the host to be added to the cluster.

The cookbook does not provide functionality for bootstrapping a Ceph cluster or managing the configuration of a Ceph cluster. These must be done using the appropriate Ceph tooling, e.g. the `cephadm`/`ceph` CLIs.

## Supported Platforms

Debian 11+

## Kitchen Testing

* Copy `.env.shadow` to `.env` and amend as appropriate. 
* Generate AWS credentials and run `kitchen` commands.

### Testing iSCSI Configuration

* To test the recipes for configuring iSCSI and LVM, set `KITCHEN_DRIVER` to `vcenter` and set the vcenter driver variables as appropriate.
* Note: access to a volume must be configured for the initiator name specified in the `.kitchen.yml`

### Bootstrapping a Single-Host Ceph Cluster

You can manually bootstrap a single-host Ceph cluster from the Test Kitchen instance by running the following on the instance:
```
sudo cephadm bootstrap --mon-ip $(hostname -I | cut -d ' ' -f1) --single-host-defaults
```

### Bootstrapping a Multi-Host Ceph Cluster

To test the bootstrapping of a multi-host Ceph cluster using instances provisioned by Test Kitchen, first generate an SSH key pair:
```
ssh-keygen -t ed25519 -f ./id_ed25519
```

Set the value of `CEPH_SSH_PUBLIC_KEY` in `.env` to the generated public key and set `ADDITIONAL_HOST_COUNT` to 2 or more.

Converge the additional instances:
```
kitchen converge --concurrency=3
```

Copy the private key to the default instance:
```
scp -i ./id_ed25519 ./id_ed25519 ./id_ed25519.pub ceph@<DEFAULT_INSTANCE_IP>:/home/ceph/.ssh/
```

Log in to the default instance:
```
kitchen login default
```

Bootstrap the cluster:
```
sudo cephadm bootstrap --mon-ip $(hostname -I | cut -d ' ' -f1) --ssh-user ceph --ssh-private-key /home/ceph/.ssh/id_ed25519 --ssh-public-key /home/ceph/.ssh/id_ed25519.pub
```

Add the other hosts:
```
sudo ceph orch host add <hostname> <ip>
```
