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

91 lines
3.1 KiB
YAML
Raw Normal View History

---
- name: Handlers
when:
- not rolling_update | bool
- not docker2podman | default(False) | bool
block:
- name: Make tempdir for scripts
ansible.builtin.tempfile:
state: directory
prefix: ceph_ansible
listen:
- "Restart ceph mons"
- "Restart ceph osds"
- "Restart ceph mdss"
- "Restart ceph rgws"
- "Restart ceph nfss"
- "Restart ceph rbdmirrors"
- "Restart ceph mgrs"
register: tmpdirpath
when: tmpdirpath is not defined or tmpdirpath.path is not defined or tmpdirpath.state=="absent"
- name: Mons handler
ansible.builtin.include_tasks: handler_mons.yml
when: mon_group_name in group_names
listen: "Restart ceph mons"
- name: Osds handler
ansible.builtin.include_tasks: handler_osds.yml
when: osd_group_name in group_names
listen: "Restart ceph osds"
- name: Mdss handler
ansible.builtin.include_tasks: handler_mdss.yml
when: mds_group_name in group_names
listen: "Restart ceph mdss"
- name: Rgws handler
ansible.builtin.include_tasks: handler_rgws.yml
when: rgw_group_name in group_names
listen: "Restart ceph rgws"
- name: Nfss handler
ansible.builtin.include_tasks: handler_nfss.yml
when: nfs_group_name in group_names
listen: "Restart ceph nfss"
- name: Rbdmirrors handler
ansible.builtin.include_tasks: handler_rbdmirrors.yml
when: rbdmirror_group_name in group_names
listen: "Restart ceph rbdmirrors"
- name: Mgrs handler
ansible.builtin.include_tasks: handler_mgrs.yml
when: mgr_group_name in group_names
listen: "Restart ceph mgrs"
- name: Ceph crash handler
ansible.builtin.include_tasks: handler_crash.yml
listen: "Restart ceph crash"
when:
- inventory_hostname in groups.get(mon_group_name, [])
or inventory_hostname in groups.get(mgr_group_name, [])
or inventory_hostname in groups.get(osd_group_name, [])
or inventory_hostname in groups.get(mds_group_name, [])
or inventory_hostname in groups.get(rgw_group_name, [])
or inventory_hostname in groups.get(rbdmirror_group_name, [])
- name: Remove tempdir for scripts
ansible.builtin.file:
path: "{{ tmpdirpath.path }}"
state: absent
listen:
- "Restart ceph mons"
- "Restart ceph osds"
- "Restart ceph mdss"
- "Restart ceph rgws"
- "Restart ceph nfss"
- "Restart ceph rbdmirrors"
- "Restart ceph mgrs"
register: tmpdirpath
when:
- tmpdirpath.path is defined
- not _crash_handler_called | default(false) | bool
- not _mds_handler_called | default(false) | bool
- not _mgr_handler_called | default(false) | bool
- not _mon_handler_called | default(false) | bool
- not _nfs_handler_called | default(false) | bool
- not _osd_handler_called | default(false) | bool
- not _rbdmirror_handler_called | default(false) | bool
- not _rgw_handler_called | default(false) | bool