deep_scrub_choked
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Include check_running_containers.yml
|
||||
ansible.builtin.include_tasks: check_running_containers.yml
|
||||
when: containerized_deployment | bool
|
||||
|
||||
- name: Include check_socket_non_container.yml
|
||||
ansible.builtin.include_tasks: check_socket_non_container.yml
|
||||
when: not containerized_deployment | bool
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
- name: Check for a mon container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-mon-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_mon_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(mon_group_name, [])
|
||||
|
||||
- name: Check for an osd container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-osd'"
|
||||
register: ceph_osd_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(osd_group_name, [])
|
||||
|
||||
- name: Check for a mds container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-mds-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_mds_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(mds_group_name, [])
|
||||
|
||||
- name: Check for a rgw container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-rgw-{{ rgw_zone }}-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_rgw_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(rgw_group_name, [])
|
||||
|
||||
- name: Check for a mgr container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-mgr-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_mgr_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(mgr_group_name, [])
|
||||
|
||||
- name: Check for a rbd mirror container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-rbd-mirror-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_rbd_mirror_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(rbdmirror_group_name, [])
|
||||
|
||||
- name: Check for a nfs container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}'"
|
||||
register: ceph_nfs_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(nfs_group_name, [])
|
||||
|
||||
- name: Check for a ceph-crash container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-crash-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_crash_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
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: Check for a ceph-exporter container
|
||||
ansible.builtin.command: "{{ container_binary }} ps -q --filter='name=ceph-exporter-{{ ansible_facts['hostname'] }}'"
|
||||
register: ceph_exporter_container_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
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, [])
|
||||
@@ -0,0 +1,234 @@
|
||||
---
|
||||
- name: Find ceph mon socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-mon*.asok"
|
||||
use_regex: false
|
||||
register: mon_socket_stat
|
||||
when: inventory_hostname in groups.get(mon_group_name, [])
|
||||
|
||||
- name: Check if the ceph mon socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: mon_socket
|
||||
with_items: "{{ mon_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mon_group_name, [])
|
||||
- mon_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph mon socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ mon_socket_stat.files }}"
|
||||
- "{{ mon_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mon_group_name, [])
|
||||
- mon_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Find ceph osd socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-osd.*.asok"
|
||||
use_regex: false
|
||||
register: osd_socket_stat
|
||||
when: inventory_hostname in groups.get(osd_group_name, [])
|
||||
|
||||
- name: Check if the ceph osd socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: osd_socket
|
||||
with_items: "{{ osd_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(osd_group_name, [])
|
||||
- osd_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph osd socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ osd_socket_stat.files }}"
|
||||
- "{{ osd_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(osd_group_name, [])
|
||||
- osd_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Find ceph osd socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-mds*.asok"
|
||||
use_regex: false
|
||||
register: mds_socket_stat
|
||||
when: inventory_hostname in groups.get(mds_group_name, [])
|
||||
|
||||
- name: Check if the ceph mds socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: mds_socket
|
||||
with_items: "{{ mds_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mds_group_name, [])
|
||||
- mds_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph mds socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ mds_socket_stat.files }}"
|
||||
- "{{ mds_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mds_group_name, [])
|
||||
- mds_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Find ceph rgw socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-client.rgw*.asok"
|
||||
use_regex: false
|
||||
register: rgw_socket_stat
|
||||
when: inventory_hostname in groups.get(rgw_group_name, [])
|
||||
|
||||
- name: Check if the ceph rgw socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rgw_socket
|
||||
with_items: "{{ rgw_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(rgw_group_name, [])
|
||||
- rgw_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph rgw socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ rgw_socket_stat.files }}"
|
||||
- "{{ rgw_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(rgw_group_name, [])
|
||||
- rgw_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Find ceph mgr socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-mgr*.asok"
|
||||
use_regex: false
|
||||
register: mgr_socket_stat
|
||||
when: inventory_hostname in groups.get(mgr_group_name, [])
|
||||
|
||||
- name: Check if the ceph mgr socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: mgr_socket
|
||||
with_items: "{{ mgr_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mgr_group_name, [])
|
||||
- mgr_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph mgr socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ mgr_socket_stat.files }}"
|
||||
- "{{ mgr_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(mgr_group_name, [])
|
||||
- mgr_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Find ceph rbd mirror socket
|
||||
ansible.builtin.find:
|
||||
paths: ["{{ rbd_client_admin_socket_path }}"]
|
||||
recurse: true
|
||||
file_type: any
|
||||
patterns: "{{ cluster }}-client.rbd-mirror*.asok"
|
||||
use_regex: false
|
||||
register: rbd_mirror_socket_stat
|
||||
when: inventory_hostname in groups.get(rbdmirror_group_name, [])
|
||||
|
||||
- name: Check if the ceph rbd mirror socket is in-use
|
||||
ansible.builtin.command: grep -q {{ item.path }} /proc/net/unix
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: rbd_mirror_socket
|
||||
with_items: "{{ rbd_mirror_socket_stat.files }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(rbdmirror_group_name, [])
|
||||
- rbd_mirror_socket_stat.files | length > 0
|
||||
|
||||
- name: Remove ceph rbd mirror socket if exists and not used by a process
|
||||
ansible.builtin.file:
|
||||
name: "{{ item.0.path }}"
|
||||
state: absent
|
||||
with_together:
|
||||
- "{{ rbd_mirror_socket_stat.files }}"
|
||||
- "{{ rbd_mirror_socket.results }}"
|
||||
when:
|
||||
- inventory_hostname in groups.get(rbdmirror_group_name, [])
|
||||
- rbd_mirror_socket_stat.files | length > 0
|
||||
- item.1.rc == 1
|
||||
|
||||
- name: Check for a nfs ganesha pid
|
||||
ansible.builtin.command: "pgrep ganesha.nfsd"
|
||||
register: nfs_process
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
when: inventory_hostname in groups.get(nfs_group_name, [])
|
||||
|
||||
- name: Check for a ceph-crash process
|
||||
ansible.builtin.command: pgrep ceph-crash
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: crash_process
|
||||
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: Check for a ceph-exporter process
|
||||
ansible.builtin.command: pgrep ceph-exporter
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: false
|
||||
register: exporter_process
|
||||
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, [])
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Set _crash_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_crash_handler_called: true
|
||||
|
||||
- name: Restart the ceph-crash service # noqa: ignore-errors
|
||||
ansible.builtin.systemd:
|
||||
name: ceph-crash@{{ ansible_facts['hostname'] }}
|
||||
state: restarted
|
||||
enabled: true
|
||||
masked: false
|
||||
daemon_reload: true
|
||||
ignore_errors: true
|
||||
when: hostvars[inventory_hostname]['_crash_handler_called'] | default(False) | bool
|
||||
|
||||
- name: Set _crash_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_crash_handler_called: false
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Set _exporter_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_exporter_handler_called: true
|
||||
|
||||
- name: Restart the ceph-exporter service # noqa: ignore-errors
|
||||
ansible.builtin.systemd:
|
||||
name: ceph-exporter@{{ ansible_facts['hostname'] }}
|
||||
state: restarted
|
||||
enabled: true
|
||||
masked: false
|
||||
daemon_reload: true
|
||||
ignore_errors: true
|
||||
when: hostvars[inventory_hostname]['_exporter_handler_called'] | default(False) | bool
|
||||
|
||||
- name: Set _exporter_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_exporter_handler_called: false
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Set _mds_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_mds_handler_called: true
|
||||
|
||||
- name: Copy mds restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_mds_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_mds_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Restart ceph mds daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_mds_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_mds_status'] | default(False) | bool
|
||||
- hostvars[item]['_mds_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[mds_group_name] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _mds_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_mds_handler_called: false
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Set _mgr_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_mgr_handler_called: true
|
||||
|
||||
- name: Copy mgr restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_mgr_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_mgr_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Restart ceph mgr daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_mgr_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_mgr_status'] | default(False) | bool
|
||||
- hostvars[item]['_mgr_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[mgr_group_name] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _mgr_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_mgr_handler_called: false
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# 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
|
||||
ansible.builtin.set_fact:
|
||||
_mon_handler_called: true
|
||||
|
||||
- name: Copy mon restart script
|
||||
ansible.builtin.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)
|
||||
ansible.builtin.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 }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _mon_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_mon_handler_called: false
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Set _nfs_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_nfs_handler_called: true
|
||||
|
||||
- name: Copy nfs restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_nfs_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_nfs_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Restart ceph nfs daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_nfs_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_nfs_status'] | default(False) | bool
|
||||
- hostvars[item]['_nfs_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[nfs_group_name] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _nfs_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_nfs_handler_called: false
|
||||
@@ -0,0 +1,122 @@
|
||||
---
|
||||
- name: Set_fact trigger_restart
|
||||
ansible.builtin.set_fact:
|
||||
trigger_restart: true
|
||||
loop: "{{ groups[osd_group_name] }}"
|
||||
when: hostvars[item]['handler_osd_status'] | default(False) | bool
|
||||
run_once: true
|
||||
|
||||
- name: Osd handler
|
||||
when: trigger_restart | default(False) | bool
|
||||
block:
|
||||
- name: Set _osd_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_osd_handler_called: true
|
||||
|
||||
- name: Unset noup flag
|
||||
ceph_osd_flag:
|
||||
name: noup
|
||||
cluster: "{{ cluster }}"
|
||||
state: absent
|
||||
environment:
|
||||
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
||||
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
run_once: true
|
||||
|
||||
# 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.
|
||||
# This does not need to run during a rolling update as the playbook will
|
||||
# restart all OSDs using the tasks "start ceph osd" or
|
||||
# "restart containerized ceph osd"
|
||||
- name: Copy osd restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_osd_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_osd_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Get pool list
|
||||
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} osd pool ls detail -f json"
|
||||
register: pool_list
|
||||
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
||||
run_once: true
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
|
||||
- name: Get balancer module status
|
||||
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer status -f json"
|
||||
register: balancer_status
|
||||
run_once: true
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
|
||||
- name: Set_fact pools_pgautoscaler_mode
|
||||
ansible.builtin.set_fact:
|
||||
pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
|
||||
run_once: true
|
||||
with_items: "{{ pool_list.stdout | default('{}') | from_json }}"
|
||||
|
||||
- name: Disable balancer
|
||||
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
changed_when: false
|
||||
when: (balancer_status.stdout | from_json)['active'] | bool
|
||||
|
||||
- name: Disable pg autoscale on pools
|
||||
ceph_pool:
|
||||
name: "{{ item.name }}"
|
||||
cluster: "{{ cluster }}"
|
||||
pg_autoscale_mode: false
|
||||
with_items: "{{ pools_pgautoscaler_mode }}"
|
||||
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
||||
run_once: true
|
||||
when:
|
||||
- pools_pgautoscaler_mode is defined
|
||||
- item.mode == 'on'
|
||||
environment:
|
||||
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
||||
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
||||
|
||||
- name: Restart ceph osds daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_osd_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_osd_status'] | default(False) | bool
|
||||
- handler_health_osd_check | bool
|
||||
- hostvars[item]['_osd_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[osd_group_name] | intersect(ansible_play_batch) }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _osd_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_osd_handler_called: false
|
||||
|
||||
- name: Re-enable pg autoscale on pools
|
||||
ceph_pool:
|
||||
name: "{{ item.name }}"
|
||||
cluster: "{{ cluster }}"
|
||||
pg_autoscale_mode: true
|
||||
with_items: "{{ pools_pgautoscaler_mode }}"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
||||
when:
|
||||
- pools_pgautoscaler_mode is defined
|
||||
- item.mode == 'on'
|
||||
environment:
|
||||
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
||||
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
||||
|
||||
- name: Re-enable balancer
|
||||
ansible.builtin.command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer on"
|
||||
run_once: true
|
||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||
changed_when: false
|
||||
when: (balancer_status.stdout | from_json)['active'] | bool
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Set _rbdmirror_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_rbdmirror_handler_called: true
|
||||
|
||||
- name: Copy rbd mirror restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_rbd_mirror_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_rbd_mirror_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Restart ceph rbd mirror daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_rbd_mirror_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_rbd_mirror_status'] | default(False) | bool
|
||||
- hostvars[item]['_rbdmirror_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[rbdmirror_group_name] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _rbdmirror_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_rbdmirror_handler_called: false
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Set _rgw_handler_called before restart
|
||||
ansible.builtin.set_fact:
|
||||
_rgw_handler_called: true
|
||||
|
||||
- name: Copy rgw restart script
|
||||
ansible.builtin.template:
|
||||
src: restart_rgw_daemon.sh.j2
|
||||
dest: "{{ tmpdirpath.path }}/restart_rgw_daemon.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0750"
|
||||
when: tmpdirpath.path is defined
|
||||
|
||||
- name: Restart ceph rgw daemon(s)
|
||||
ansible.builtin.command: /usr/bin/env bash {{ hostvars[item]['tmpdirpath']['path'] }}/restart_rgw_daemon.sh
|
||||
when:
|
||||
- hostvars[item]['handler_rgw_status'] | default(False) | bool
|
||||
- hostvars[item]['_rgw_handler_called'] | default(False) | bool
|
||||
- hostvars[item].tmpdirpath.path is defined
|
||||
with_items: "{{ groups[rgw_group_name] }}"
|
||||
delegate_to: "{{ item }}"
|
||||
changed_when: false
|
||||
run_once: true
|
||||
|
||||
- name: Set _rgw_handler_called after restart
|
||||
ansible.builtin.set_fact:
|
||||
_rgw_handler_called: false
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
- name: Include check_running_cluster.yml
|
||||
ansible.builtin.include_tasks: check_running_cluster.yml
|
||||
|
||||
# We do not want to run these checks on initial deployment (`socket.rc == 0`)
|
||||
- name: Set_fact handler_mon_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_mon_status: "{{ 0 in (mon_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_mon_container_stat.get('rc') == 0 and ceph_mon_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(mon_group_name, [])
|
||||
|
||||
- name: Set_fact handler_osd_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_osd_status: "{{ 0 in (osd_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_osd_container_stat.get('rc') == 0 and ceph_osd_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(osd_group_name, [])
|
||||
|
||||
- name: Set_fact handler_mds_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_mds_status: "{{ 0 in (mds_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_mds_container_stat.get('rc') == 0 and ceph_mds_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(mds_group_name, [])
|
||||
|
||||
- name: Set_fact handler_rgw_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_rgw_status: "{{ 0 in (rgw_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_rgw_container_stat.get('rc') == 0 and ceph_rgw_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(rgw_group_name, [])
|
||||
|
||||
- name: Set_fact handler_nfs_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_nfs_status: "{{ (nfs_process.get('rc') == 0) if not containerized_deployment | bool else (ceph_nfs_container_stat.get('rc') == 0 and ceph_nfs_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(nfs_group_name, [])
|
||||
|
||||
- name: Set_fact handler_rbd_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_rbd_mirror_status: "{{ 0 in (rbd_mirror_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_rbd_mirror_container_stat.get('rc') == 0 and ceph_rbd_mirror_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(rbdmirror_group_name, [])
|
||||
|
||||
- name: Set_fact handler_mgr_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_mgr_status: "{{ 0 in (mgr_socket.results | map(attribute='rc') | list) if not containerized_deployment | bool else (ceph_mgr_container_stat.get('rc') == 0 and ceph_mgr_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
when: inventory_hostname in groups.get(mgr_group_name, [])
|
||||
|
||||
- name: Set_fact handler_crash_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_crash_status: "{{ crash_process.get('rc') == 0 if not containerized_deployment | bool else (ceph_crash_container_stat.get('rc') == 0 and ceph_crash_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
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: Set_fact handler_exporter_status
|
||||
ansible.builtin.set_fact:
|
||||
handler_exporter_status: "{{ exporter_process.get('rc') == 0 if not containerized_deployment | bool else (ceph_exporter_container_stat.get('rc') == 0 and ceph_exporter_container_stat.get('stdout_lines', []) | length != 0) }}"
|
||||
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, [])
|
||||
Reference in New Issue
Block a user