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

75 lines
1.9 KiB
YAML

---
- name: update apt cache
apt:
update-cache: yes
when: ansible_os_family == 'Debian'
- block:
- name: copy mon restart script
template:
src: restart_mon_daemon.sh.j2
dest: /tmp/restart_mon_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph mons"
- name: restart ceph mon daemon(s)
command: /tmp/restart_mon_daemon.sh
listen: "restart ceph mons"
when:
- mon_group_name in group_names
# 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.
- block:
- name: copy osd restart script
template:
src: restart_osd_daemon.sh.j2
dest: /tmp/restart_osd_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph osds"
- name: restart ceph osds daemon(s)
command: /tmp/restart_osd_daemon.sh
listen: "restart ceph osds"
when:
- handler_health_osd_check
when:
- osd_group_name in group_names
- name: restart ceph mdss
service:
name: ceph-mds@{{ mds_name }}
state: restarted
# serial: 1 would be the proper solution here, but that can only be set on play level
# upstream issue: https://github.com/ansible/ansible/issues/12170
run_once: true
with_items: "{{ groups.get(mds_group_name, []) }}"
delegate_to: "{{ item }}"
when:
- mds_group_name in group_names
- name: restart ceph rgws
service:
name: ceph-radosgw@rgw.{{ ansible_hostname }}
state: restarted
# serial: 1 would be the proper solution here, but that can only be set on play level
# upstream issue: https://github.com/ansible/ansible/issues/12170
run_once: true
with_items: "{{ groups.get(rgw_group_name, []) }}"
delegate_to: "{{ item }}"
when:
- rgw_group_name in group_names
- name: restart ceph nfss
service:
name: nfs-ganesha
state: restarted
when:
- nfs_group_name in group_names