ceph-ansible/roles/ceph-common/handlers/main.yml

131 lines
3.6 KiB
YAML

---
- name: update apt cache
apt:
update-cache: yes
- name: restart ceph mons
command: service ceph restart mon
when:
- socket.rc == 0
- ansible_distribution != 'Ubuntu'
- mon_group_name in group_names
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- name: restart ceph mons with systemd
service:
name: ceph-mon@{{ monitor_name }}
state: restarted
when:
- socket.rc == 0
- use_systemd
- mon_group_name in group_names
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- name: restart ceph mons on ubuntu
command: initctl restart ceph-mon cluster={{ cluster }} id={{ monitor_name }}
when:
- socket.rc == 0
- ansible_distribution == 'Ubuntu'
- not use_systemd
- mon_group_name in group_names
- name: restart ceph osds
command: service ceph restart osd
when:
- socket.rc == 0
- ansible_distribution != 'Ubuntu'
- osd_group_name in group_names
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
# This does not just restart OSDs but everything else too. Unfortunately
# at this time the ansible role does not have an OSD id list to use
# for restarting them specifically.
- name: restart ceph osds with systemd
service:
name: ceph.target
state: restarted
when:
- socket.rc == 0
- use_systemd
- osd_group_name in group_names
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- name: restart ceph osds on ubuntu
shell: |
for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do
initctl restart ceph-osd cluster={{ cluster }} id=$id
done
when:
- socket.rc == 0
- ansible_distribution == 'Ubuntu'
- not use_systemd
- osd_group_name in group_names
- name: restart ceph mdss on ubuntu
command: initctl restart ceph-mds cluster={{ cluster }} id={{ ansible_hostname }}
when:
- socket.rc == 0
- ansible_distribution == 'Ubuntu'
- not use_systemd
- mds_group_name in group_names
- name: restart ceph mdss
command: service ceph restart mds
when:
- socket.rc == 0
- ansible_distribution != 'Ubuntu'
- use_systemd
- mds_group_name in group_names
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- name: restart ceph mdss with systemd
service:
name: ceph-mds@{{ mds_name }}
state: restarted
when:
- socket.rc == 0
- use_systemd
- mds_group_name in group_names
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- name: restart ceph rgws on ubuntu
command: initctl restart radosgw cluster={{ cluster }} id=rgw.{{ ansible_hostname }}
when:
- socketrgw.rc == 0
- ansible_distribution == 'Ubuntu'
- not use_systemd
- rgw_group_name in group_names
- name: restart ceph rgws
command: /etc/init.d/radosgw restart
when:
- socketrgw.rc == 0
- ansible_distribution != 'Ubuntu'
- rgw_group_name in group_names
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- name: restart ceph rgws on red hat
command: /etc/init.d/ceph-radosgw restart
when:
- socketrgw.rc == 0
- ansible_os_family == 'RedHat'
- rgw_group_name in group_names
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- name: restart ceph rgws with systemd
service:
name: ceph-rgw@{{ ansible_hostname }}
state: restarted
when:
- socketrgw.rc == 0
- use_systemd
- rgw_group_name in group_names
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- name: restart ceph nfss
service:
name: nfs-ganesha
state: restarted
when:
- nfs_group_name in group_names