]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
check if mon daemon is installed before restarting it
authorRishabh Dave <ridave@redhat.com>
Sat, 6 Apr 2019 06:15:31 +0000 (02:15 -0400)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 15 Apr 2019 08:00:50 +0000 (10:00 +0200)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
roles/ceph-handler/templates/restart_mon_daemon.sh.j2

index 36d50ac9fc68149aba881796d62ff43970adb5b5..301cb10a38677d3a761215d6f2a402d4864c5af1 100644 (file)
@@ -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