ceph-ansible/roles/ceph-handler/tasks/handler_mons.yml

32 lines
1.1 KiB
YAML

---
# We only want to restart on hosts that have called the handler.
# This var is set when he handler is called, and unset after the
# restart to ensure only the correct hosts are restarted.
- name: set _mon_handler_called before restart
set_fact:
_mon_handler_called: True
- name: copy mon restart script
template:
src: restart_mon_daemon.sh.j2
dest: "{{ tmpdirpath.path }}/restart_mon_daemon.sh"
owner: root
group: root
mode: 0750
when: tmpdirpath.path is defined
- name: restart ceph mon daemon(s)
command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_mon_daemon.sh
when:
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
- hostvars[item]['handler_mon_status'] | default(False) | bool
- hostvars[item]['_mon_handler_called'] | default(False) | bool
- hostvars[item].tmpdirpath.path is defined
with_items: "{{ groups[mon_group_name] }}"
delegate_to: "{{ item }}"
run_once: True
- name: set _mon_handler_called after restart
set_fact:
_mon_handler_called: False