can have multiple labels. They can be used to specify placement
of daemons. See :ref:`orch-placement-by-labels`
-To add a label, run::
+Labels can be added when adding a host with the ``--labels`` flag::
+
+ ceph orch host add my_hostname --labels=my_label1
+ ceph orch host add my_hostname --labels=my_label1,my_label2
+
+To add a label a existing host, run::
ceph orch host label add my_hostname my_label
To add the cephadm SSH key to the host:
> ceph cephadm get-pub-key > ~/ceph.pub
-> ssh-copy-id -f -i ~/ceph.pub {user}@{host}
+> ssh-copy-id -f -i ~/ceph.pub {user}@{addr}
To check that the host is reachable:
> ceph cephadm get-ssh-config > ssh_config
> ceph config-key get mgr/cephadm/ssh_identity_key > ~/cephadm_private_key
> chmod 0600 ~/cephadm_private_key
-> ssh -F ssh_config -i ~/cephadm_private_key {user}@{host}'''
+> ssh -F ssh_config -i ~/cephadm_private_key {user}@{addr}'''
raise OrchestratorError(msg) from e
except Exception as ex:
self.log.exception(ex)
def _add_host(self, hostname: str, addr: Optional[str] = None, labels: Optional[List[str]] = None, maintenance: Optional[bool] = False) -> HandleCommandResult:
"""Add a host"""
_status = 'maintenance' if maintenance else ''
+
+ # split multiple labels passed in with --labels=label1,label2
+ if labels and len(labels) == 1:
+ labels = labels[0].split(',')
+
s = HostSpec(hostname=hostname, addr=addr, labels=labels, status=_status)
return self._apply_misc([s], False, Format.plain)