From 958d2525da69aded35a8ba6d7ea6910212d21b8d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:20 -0400 Subject: [PATCH] Handle restarting ceph-mon/mgr sequentially --- roles/pvc/handlers/main.yml | 22 ++++++++++++++++++++++ roles/pvc/tasks/ceph/main.yml | 3 +++ 2 files changed, 25 insertions(+) diff --git a/roles/pvc/handlers/main.yml b/roles/pvc/handlers/main.yml index 50eba47..63c807c 100644 --- a/roles/pvc/handlers/main.yml +++ b/roles/pvc/handlers/main.yml @@ -19,6 +19,28 @@ name: patroni state: restarted +# Restart ceph-mon, but sequentially one-host-at-a-time with a 15s wait in between; this provides +# plenty of time for the primary state to switch around without putting the cluster in a +# no-primary state +- name: restart ceph-mon + shell: systemctl restart ceph-mon@{{ play_host }} && sleep 15 + run_once: true + delegate_to: "{{ play_host }}" + with_items: "{{ play_hosts }}" + loop_control: + loop_var: play_host + +# Restart ceph-mgr, but sequentially one-host-at-a-time with a 15s wait in between; this provides +# plenty of time for the primary state to switch around without putting the cluster in a +# no-primary state +- name: restart ceph-mgr + shell: systemctl restart ceph-mgr@{{ play_host }} && sleep 15 + run_once: true + delegate_to: "{{ play_host }}" + with_items: "{{ play_hosts }}" + loop_control: + loop_var: play_host + # Restart pvcd, but sequentially one-host-at-a-time with a 15s wait in between; this provides # plenty of time for the primary state to switch around without putting the cluster in a # no-primary state diff --git a/roles/pvc/tasks/ceph/main.yml b/roles/pvc/tasks/ceph/main.yml index 4bc11f8..96ca1ec 100644 --- a/roles/pvc/tasks/ceph/main.yml +++ b/roles/pvc/tasks/ceph/main.yml @@ -44,6 +44,9 @@ owner: ceph group: ceph mode: 0640 + notify: + - restart ceph-mon + - restart ceph-mgr with_items: - ceph.conf - ceph.mon.keyring