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

297 lines
10 KiB
YAML

---
- name: update apt cache
apt:
update-cache: yes
when:
- ansible_os_family == 'Debian'
- 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"
when:
- mon_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph mon daemon(s) - non container
command: /tmp/restart_mon_daemon.sh
listen: "restart ceph mons"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mon_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(mon_group_name) | last
- inventory_hostname in play_hosts
- mon_socket_stat.rc == 0
with_items: "{{ groups[mon_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph mon daemon(s) - container
command: /tmp/restart_mon_daemon.sh
listen: "restart ceph mons"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mon_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(mon_group_name) | last
- inventory_hostname in play_hosts
- ceph_mon_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[mon_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
# 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: 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"
when:
- osd_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph osds daemon(s) - non container
command: /tmp/restart_osd_daemon.sh
listen: "restart ceph osds"
when:
- osd_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(osd_group_name) | last
# We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`)
# except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
- ((crush_location is defined and crush_location) or osd_socket_stat.rc == 0)
- ceph_current_fsid.rc == 0
- handler_health_osd_check
# See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
- inventory_hostname in play_hosts
with_items: "{{ groups[osd_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph osds daemon(s) - container
command: /tmp/restart_osd_daemon.sh
listen: "restart ceph osds"
when:
# We do not want to run these checks on initial deployment (`socket_osd_container_stat.results[n].rc == 0`)
# except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified
- osd_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(osd_group_name) | last
- ((crush_location is defined and crush_location) or ceph_osd_container_stat.get('stdout_lines', [])|length != 0)
- handler_health_osd_check
# See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
- inventory_hostname in play_hosts
with_items: "{{ groups[osd_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: copy mds restart script
template:
src: restart_mds_daemon.sh.j2
dest: /tmp/restart_mds_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph mdss"
when:
- mds_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph mds daemon(s) - non container
command: /tmp/restart_mds_daemon.sh
listen: "restart ceph mdss"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mds_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(mds_group_name) | last
- inventory_hostname in play_hosts
- mds_socket_stat.rc == 0
with_items: "{{ groups[mds_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph mds daemon(s) - container
command: /tmp/restart_mds_daemon.sh
listen: "restart ceph mdss"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mds_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(mds_group_name) | last
- inventory_hostname in play_hosts
- ceph_mds_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[mds_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: copy rgw restart script
template:
src: restart_rgw_daemon.sh.j2
dest: /tmp/restart_rgw_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph rgws"
when:
- rgw_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph rgw daemon(s) - non container
command: /tmp/restart_rgw_daemon.sh
listen: "restart ceph rgws"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rgw_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(rgw_group_name) | last
- inventory_hostname in play_hosts
- rgw_socket_stat.rc == 0
with_items: "{{ groups[rgw_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph rgw daemon(s) - container
command: /tmp/restart_rgw_daemon.sh
listen: "restart ceph rgws"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rgw_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(rgw_group_name) | last
- inventory_hostname in play_hosts
- ceph_rgw_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[rgw_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: copy nfs restart script
template:
src: restart_nfs_daemon.sh.j2
dest: /tmp/restart_nfs_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph nfss"
when:
- nfs_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph nfs daemon(s) - non container
command: /tmp/restart_nfs_daemon.sh
listen: "restart ceph nfss"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- nfs_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(nfs_group_name) | last
- inventory_hostname in play_hosts
- nfs_socket_stat.rc == 0
with_items: "{{ groups[nfs_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph nfs daemon(s) - container
command: /tmp/restart_nfs_daemon.sh
listen: "restart ceph nfss"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- nfs_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(nfs_group_name) | last
- inventory_hostname in play_hosts
- ceph_nfs_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[nfs_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: copy rbd mirror restart script
template:
src: restart_rbd_mirror_daemon.sh.j2
dest: /tmp/restart_rbd_mirror_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph rbdmirrors"
when:
- rbdmirror_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph rbd mirror daemon(s) - non container
command: /tmp/restart_rbd_mirror_daemon.sh
listen: "restart ceph rbdmirrors"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rbdmirror_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(rbdmirror_group_name) | last
- inventory_hostname in play_hosts
- rbd_mirror_socket_stat.rc == 0
with_items: "{{ groups[rbdmirror_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph rbd mirror daemon(s) - container
command: /tmp/restart_rbd_mirror_daemon.sh
listen: "restart ceph rbdmirrors"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rbdmirror_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(rbdmirror_group_name) | last
- inventory_hostname in play_hosts
- ceph_rbd_mirror_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[rbdmirror_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: copy mgr restart script
template:
src: restart_mgr_daemon.sh.j2
dest: /tmp/restart_mgr_daemon.sh
owner: root
group: root
mode: 0750
listen: "restart ceph mgrs"
when:
- mgr_group_name in group_names
- inventory_hostname in play_hosts
- name: restart ceph mgr daemon(s) - non container
command: /tmp/restart_mgr_daemon.sh
listen: "restart ceph mgrs"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mgr_group_name in group_names
- not containerized_deployment
- inventory_hostname == groups.get(mgr_group_name) | last
- inventory_hostname in play_hosts
- mgr_socket_stat.rc == 0
with_items: "{{ groups[mgr_group_name] }}"
run_once: true
delegate_to: "{{ item }}"
- name: restart ceph mgr daemon(s) - container
command: /tmp/restart_mgr_daemon.sh
listen: "restart ceph mgrs"
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mgr_group_name in group_names
- containerized_deployment
- inventory_hostname == groups.get(mgr_group_name) | last
- inventory_hostname in play_hosts
- ceph_mgr_container_stat.get('stdout_lines', [])|length != 0
with_items: "{{ groups[mgr_group_name] }}"
run_once: true
delegate_to: "{{ item }}"