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

227 lines
7.1 KiB
YAML

---
- 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 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, [])