]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Restart Ceph service after a configuration change 106/head
authorSébastien Han <sebastien.han@enovance.com>
Wed, 20 Aug 2014 12:04:34 +0000 (14:04 +0200)
committerSébastien Han <sebastien.han@enovance.com>
Wed, 20 Aug 2014 12:04:34 +0000 (14:04 +0200)
After a change is made on the configuration file we must restart the
Ceph services. I also added a check that verifies if a socker exists
because during the first play there are no services running. We check if
a socket exists, if not we don't try to restart the services, if it
exists we can restart them.

Signed-off-by: Sébastien Han <sebastien.han@enovance.com>
roles/ceph-common/handlers/main.yml
roles/ceph-common/tasks/Debian.yml
roles/ceph-common/tasks/RedHat.yml

index 3d83a193f9e10ef3cfcdcc7adb926c6384518e0d..44be529ad8a31d87efad0845369a8b3d455f3d04 100644 (file)
@@ -2,3 +2,11 @@
 
 - name: "update apt cache"
   action: apt update-cache=yes
+
+- name: "restart ceph"
+  shell: service ceph restart ; service ceph-osd-all restart
+  when: socket.rc == 0 and ansible_distribution == 'Ubuntu'
+
+- name: "restart ceph"
+  command: service ceph restart
+  when: socket.rc == 0 and ansible_distribution == 'Debian' or ansible_os_family == 'RedHat'
index e7c70672577e988bb09c7a2ad8e8d09a6f01ccf6..b436668a6385e6b4895bf7acb4c7540473bef8e4 100644 (file)
     - ceph-mds       #|--> they don't get update so we need to force them
     - libcephfs1     #|
 
-- name: Generate ceph configuration file
+- name: Check for a Ceph socket
+  shell: stat /var/run/ceph/*.asok > /dev/null 2>&1
+  ignore_errors: true
+  register: socket
+
+- name: Generate Ceph configuration file
   template: src=ceph.conf.j2 dest=/etc/ceph/ceph.conf owner=root group=root mode=0644
+  notify: restart ceph
index c4965f6abed628ba5f0b39db79537fa01648e302..08ef0126818747a7608d0c42349f2043a36ff252 100644 (file)
 - name: Install Ceph
   yum: name=ceph state=latest
 
+- name: Check for a Ceph socket
+  shell: stat /var/run/ceph/*.asok > /dev/null 2>&1
+  ignore_errors: true
+  register: socket
+
 - name: Generate Ceph configuration file
   template: src=ceph.conf.j2 dest=/etc/ceph/ceph.conf owner=root group=root mode=0644
+  notify: restart ceph