From: Rishabh Dave Date: Sat, 6 Apr 2019 06:15:31 +0000 (-0400) Subject: check if mon daemon is installed before restarting it X-Git-Tag: v4.0.0rc4~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a3e4bf37962d6b8a3bd01fd49b2ff213358dcbb5;p=ceph-ansible.git check if mon daemon is installed before restarting it Signed-off-by: Rishabh Dave (cherry picked from commit 96c180cc0ea6d39555e72da5ba3ae758be1b38ba) --- diff --git a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 index 36d50ac9f..301cb10a3 100644 --- a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 @@ -7,6 +7,12 @@ MONITOR_NAME="{{ monitor_name }}" DOCKER_EXEC="{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}" {% endif %} +# if daemon is uninstalled, no restarting is needed; so exit with success +systemctl status ceph-mon@{{ ansible_hostname }} > /dev/null +if [[ $? -ne 0 ]]; then + exit 0 +fi + # Backward compatibility $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-mon.{{ ansible_fqdn }}.asok $DOCKER_EXEC test -S /var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok && SOCKET=/var/run/ceph/{{ cluster }}-mon.{{ ansible_hostname }}.asok