-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ceph-crash: introduce new role ceph-crash
This commit introduces a new role `ceph-crash` in order to deploy everything needed for the ceph-crash daemon. Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com> (cherry picked from commit 9d2f210)
- Loading branch information
Showing
19 changed files
with
395 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
galaxy_info: | ||
company: Red Hat | ||
author: Guillaume Abrioux | ||
description: Deploy ceph-crash | ||
license: Apache | ||
min_ansible_version: 2.7 | ||
platforms: | ||
- name: EL | ||
versions: | ||
- 7 | ||
- 8 | ||
galaxy_tags: | ||
- system | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
- name: create and copy client.crash keyring | ||
when: cephx | bool | ||
block: | ||
- name: create client.crash keyring | ||
ceph_key: | ||
state: present | ||
name: "client.crash" | ||
caps: "{{ {'mon': 'allow profile crash', 'mgr': 'allow profile crash'} }}" | ||
cluster: "{{ cluster }}" | ||
dest: "{{ ceph_conf_key_directory }}" | ||
import_key: True | ||
mode: "{{ ceph_keyring_permissions }}" | ||
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" | ||
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" | ||
environment: | ||
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" | ||
CEPH_CONTAINER_BINARY: "{{ container_binary }}" | ||
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}" | ||
run_once: True | ||
|
||
- name: get keys from monitors | ||
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} auth get client.crash" | ||
register: _crash_keys | ||
delegate_to: "{{ groups.get(mon_group_name)[0] }}" | ||
run_once: true | ||
|
||
- name: get a list of node where the keyring should be copied | ||
set_fact: | ||
list_target_node: "{{ list_target_node | default([]) | union(((groups.get('all') | difference(groups.get(grafana_server_group_name, []) + groups.get(client_group_name, []) + groups.get(nfs_group_name, []) + groups.get(iscsi_gw_group_name, []))) + groups.get(item, [])) | unique) }}" | ||
run_once: True | ||
with_items: | ||
- "{{ mon_group_name if groups.get(mon_group_name, []) | length > 0 else [] }}" | ||
- "{{ osd_group_name if groups.get(osd_group_name, []) | length > 0 else [] }}" | ||
- "{{ mds_group_name if groups.get(mds_group_name, []) | length > 0 else [] }}" | ||
- "{{ rgw_group_name if groups.get(rgw_group_name, []) | length > 0 else [] }}" | ||
- "{{ rbdmirror_group_name if groups.get(rbdmirror_group_name, []) | length > 0 else [] }}" | ||
- "{{ mgr_group_name if groups.get(mgr_group_name, []) | length > 0 else [] }}" | ||
|
||
- name: copy ceph key(s) if needed | ||
copy: | ||
dest: "{{ ceph_conf_key_directory }}/{{ cluster }}.client.crash.keyring" | ||
content: "{{ _crash_keys.stdout + '\n' }}" | ||
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" | ||
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" | ||
mode: "{{ ceph_keyring_permissions }}" | ||
with_items: "{{ list_target_node }}" | ||
delegate_to: "{{ item }}" | ||
run_once: True | ||
|
||
- name: start ceph-crash daemon | ||
when: containerized_deployment | bool | ||
block: | ||
- name: create /var/lib/ceph/crash/posted | ||
file: | ||
path: /var/lib/ceph/crash/posted | ||
state: directory | ||
mode: '0755' | ||
owner: "{{ ceph_uid }}" | ||
group: "{{ ceph_uid }}" | ||
|
||
- name: include_tasks systemd.yml | ||
include_tasks: systemd.yml | ||
|
||
- name: start the ceph-crash service | ||
systemd: | ||
name: "{{ 'ceph-crash@' + ansible_hostname if containerized_deployment | bool else 'ceph-crash.service' }}" | ||
state: started | ||
enabled: yes | ||
masked: no | ||
daemon_reload: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: generate systemd unit file for ceph-crash container | ||
template: | ||
src: "{{ role_path }}/templates/ceph-crash.service.j2" | ||
dest: /etc/systemd/system/ceph-crash@.service | ||
owner: "root" | ||
group: "root" | ||
mode: "0644" | ||
notify: restart ceph crash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[Unit] | ||
Description=Ceph crash dump collector | ||
{% if container_binary == 'docker' %} | ||
After=docker.service | ||
Requires=docker.service | ||
{% else %} | ||
After=network.target | ||
{% endif %} | ||
|
||
[Service] | ||
{% if container_binary == 'podman' %} | ||
ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid | ||
ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-crash-%i | ||
{% endif %} | ||
ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-crash-%i \ | ||
{% if container_binary == 'podman' %} | ||
-d --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \ | ||
{% endif %} | ||
--net=host \ | ||
-v /var/lib/ceph:/var/lib/ceph:z \ | ||
-v /etc/localtime:/etc/localtime:ro \ | ||
--entrypoint=/usr/bin/ceph-crash {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} | ||
{% if container_binary == 'podman' %} | ||
ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`" | ||
{% else %} | ||
ExecStop=-/usr/bin/{{ container_binary }} stop ceph-crash-%i | ||
{% endif %} | ||
StartLimitInterval=10min | ||
StartLimitBurst=30 | ||
{% if container_binary == 'podman' %} | ||
Type=forking | ||
PIDFile=/%t/%n-pid | ||
{% endif %} | ||
KillMode=none | ||
Restart=always | ||
RestartSec=10s | ||
TimeoutStartSec=120 | ||
TimeoutStopSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: set _crash_handler_called before restart | ||
set_fact: | ||
_crash_handler_called: True | ||
|
||
- name: restart the ceph-crash service | ||
systemd: | ||
name: ceph-crash@{{ ansible_hostname }} | ||
state: restarted | ||
enabled: yes | ||
masked: no | ||
daemon_reload: yes | ||
ignore_errors: true | ||
when: hostvars[inventory_hostname]['_crash_handler_called'] | default(False) | bool | ||
|
||
- name: set _crash_handler_called after restart | ||
set_fact: | ||
_crash_handler_called: False |
Oops, something went wrong.