Adding multiple hosts

Use a YAML file to add multiple hosts to the storage cluster at the same time.

NOTE: Be sure to create the hosts.yaml file within a host container, or create the file on the local host and then use the cephadm shell to mount the file within the container. The cephadm shell automatically places mounted files in /mnt. If you create the file directly on the local host and then apply the hosts.yaml file instead of mounting it, you might see a File does not exist error.

Prerequisites

  • A storage cluster that has been installed and bootstrapped.

  • Root-level access to all nodes in the storage cluster.

Procedure

  1. Copy over the public ssh key to each of the hosts that you want to add.

  2. Use a text editor to create a hosts.yaml file.

  3. Add the host descriptions to the hosts.yaml file, as shown in the following example. Include the labels to identify placements for the daemons that you want to deploy on each host. Separate each host description with three dashes (---).

    Example

    service_type: host
    addr:
    hostname: host02
    labels:
    - mon
    - osd
    - mgr
    ---
    service_type: host
    addr:
    hostname: host03
    labels:
    - mon
    - osd
    - mgr
    ---
    service_type: host
    addr:
    hostname: host04
    labels:
    - mon
    - osd
  4. If you created the hosts.yaml file within the host container, invoke the ceph orch apply command:

    Example

    [root@host01 ~]# ceph orch apply -i hosts.yaml
    Added host 'host02' with addr '10.10.128.69'
    Added host 'host03' with addr '10.10.128.70'
    Added host 'host04' with addr '10.10.128.71'
  5. If you created the hosts.yaml file directly on the local host, use the cephadm shell to mount the file:

    Example

    [root@host01 ~]# cephadm shell --mount hosts.yaml -- ceph orch apply -i /mnt/hosts.yaml
  6. View the list of hosts and their labels:

    Example

    [root@host01 ~]# ceph orch host ls
    HOST      ADDR      LABELS          STATUS
    host02   host02    mon osd mgr
    host03   host03    mon osd mgr
    host04   host04    mon osd

    NOTE: If a host is online and operating normally, its status is blank. An offline host shows a status of OFFLINE, and a host in maintenance mode shows a status of MAINTENANCE.