From adfb56a8faafbce8547d0c3da2fa6921104607df Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 8 Aug 2024 12:36:54 +0100 Subject: [PATCH] Add ceph-{enter,exit}-maintenance.yml playbooks These can be used to enter and exit maintenance for Ceph hosts. --- doc/source/operations/upgrading-ceph.rst | 7 ++++--- etc/kayobe/ansible/ceph-enter-maintenance.yml | 13 +++++++++++++ etc/kayobe/ansible/ceph-exit-maintenance.yml | 12 ++++++++++++ etc/kayobe/ansible/requirements.yml | 2 +- .../notes/ceph-maintenance-4c4eb0a4f7149665.yaml | 15 +++++++++++++++ 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 etc/kayobe/ansible/ceph-enter-maintenance.yml create mode 100644 etc/kayobe/ansible/ceph-exit-maintenance.yml create mode 100644 releasenotes/notes/ceph-maintenance-4c4eb0a4f7149665.yaml diff --git a/doc/source/operations/upgrading-ceph.rst b/doc/source/operations/upgrading-ceph.rst index 838a518a4..5ce711011 100644 --- a/doc/source/operations/upgrading-ceph.rst +++ b/doc/source/operations/upgrading-ceph.rst @@ -63,7 +63,7 @@ Place the host or batch of hosts into maintenance mode: .. code-block:: console - sudo cephadm shell -- ceph orch host maintenance enter + kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ceph-enter-maintenance.yml -l To update all eligible packages, use ``*``, escaping if necessary: @@ -72,7 +72,8 @@ To update all eligible packages, use ``*``, escaping if necessary: kayobe overcloud host package update --packages "*" --limit If the kernel has been upgraded, reboot the host or batch of hosts to pick up -the change: +the change. While running this playbook, consider setting ``ANSIBLE_SERIAL`` to +the maximum number of hosts that can safely reboot concurrently. .. code-block:: console @@ -82,7 +83,7 @@ Remove the host or batch of hosts from maintenance mode: .. code-block:: console - sudo cephadm shell -- ceph orch host maintenance exit + kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/ceph-exit-maintenance.yml -l Wait for Ceph health to return to ``HEALTH_OK``: diff --git a/etc/kayobe/ansible/ceph-enter-maintenance.yml b/etc/kayobe/ansible/ceph-enter-maintenance.yml new file mode 100644 index 000000000..c119583e1 --- /dev/null +++ b/etc/kayobe/ansible/ceph-enter-maintenance.yml @@ -0,0 +1,13 @@ +--- +- name: Ensure a Ceph host has entered maintenance + gather_facts: true + any_errors_fatal: true + # We need to check whether it is OK to stop hosts after previous hosts have + # entered maintenance. + serial: 1 + hosts: ceph + become: true + tasks: + - name: Ensure a Ceph host has entered maintenance + ansible.builtin.import_role: + name: stackhpc.cephadm.enter_maintenance diff --git a/etc/kayobe/ansible/ceph-exit-maintenance.yml b/etc/kayobe/ansible/ceph-exit-maintenance.yml new file mode 100644 index 000000000..a16f338d9 --- /dev/null +++ b/etc/kayobe/ansible/ceph-exit-maintenance.yml @@ -0,0 +1,12 @@ +--- +- name: Ensure a Ceph host has exited maintenance + gather_facts: true + any_errors_fatal: true + hosts: ceph + # The role currently requires hosts to exit maintenance serially. + serial: 1 + become: true + tasks: + - name: Ensure a Ceph host has exited maintenance + ansible.builtin.import_role: + name: stackhpc.cephadm.exit_maintenance diff --git a/etc/kayobe/ansible/requirements.yml b/etc/kayobe/ansible/requirements.yml index 90e653ab2..2bb4047ce 100644 --- a/etc/kayobe/ansible/requirements.yml +++ b/etc/kayobe/ansible/requirements.yml @@ -1,7 +1,7 @@ --- collections: - name: stackhpc.cephadm - version: 1.15.1 + version: 1.18.0 # NOTE: Pinning pulp.squeezer to 0.0.13 because 0.0.14+ depends on the # pulp_glue Python library being installed. - name: pulp.squeezer diff --git a/releasenotes/notes/ceph-maintenance-4c4eb0a4f7149665.yaml b/releasenotes/notes/ceph-maintenance-4c4eb0a4f7149665.yaml new file mode 100644 index 000000000..285e396f8 --- /dev/null +++ b/releasenotes/notes/ceph-maintenance-4c4eb0a4f7149665.yaml @@ -0,0 +1,15 @@ +--- +features: + - | + Adds two new custom playbooks for placing Ceph hosts into and removing them + from maintenance: + + - ``ceph-enter-maintenance.yml`` + - ``ceph-exit-maintenance.yml`` +upgrade: + - | + Updates the ``stackhpc.cephadm`` collection to version ``1.18.0``. +fixes: + - | + Fixes an issue with idempotency in the ``stackhpc.ceph.cephadm_keys`` + plugin.