Restart Ceph service after a configuration change

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>
pull/106/head
Sébastien Han 2014-08-20 14:04:34 +02:00
parent 06585ced93
commit 0aa9dea281
3 changed files with 21 additions and 1 deletions

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

View File

@ -37,5 +37,11 @@
- 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

View File

@ -30,5 +30,11 @@
- 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