2019-10-10 01:58:33 +08:00
|
|
|
---
|
|
|
|
# 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.
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set _mon_handler_called before restart
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
_mon_handler_called: true
|
2019-10-10 01:58:33 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Copy mon restart script
|
|
|
|
ansible.builtin.template:
|
2019-10-10 01:58:33 +08:00
|
|
|
src: restart_mon_daemon.sh.j2
|
2019-11-29 01:28:53 +08:00
|
|
|
dest: "{{ tmpdirpath.path }}/restart_mon_daemon.sh"
|
2019-10-10 01:58:33 +08:00
|
|
|
owner: root
|
|
|
|
group: root
|
2024-02-14 18:14:02 +08:00
|
|
|
mode: "0750"
|
2021-12-30 22:08:08 +08:00
|
|
|
when: tmpdirpath.path is defined
|
2019-10-10 01:58:33 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Restart ceph mon daemon(s)
|
|
|
|
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_mon_daemon.sh
|
2019-10-10 01:58:33 +08:00
|
|
|
when:
|
|
|
|
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
|
2019-12-19 18:29:41 +08:00
|
|
|
- hostvars[item]['handler_mon_status'] | default(False) | bool
|
2019-10-10 01:58:33 +08:00
|
|
|
- hostvars[item]['_mon_handler_called'] | default(False) | bool
|
2021-12-30 22:08:08 +08:00
|
|
|
- hostvars[item].tmpdirpath.path is defined
|
2019-10-10 01:58:33 +08:00
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
|
|
|
delegate_to: "{{ item }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
changed_when: false
|
|
|
|
run_once: true
|
2019-10-10 01:58:33 +08:00
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Set _mon_handler_called after restart
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
_mon_handler_called: false
|