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>
- 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'
- 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
- 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