mirror of https://github.com/ceph/ceph-ansible.git
78 lines
2.9 KiB
YAML
78 lines
2.9 KiB
YAML
---
|
|
- name: create and copy client.crash keyring
|
|
when: cephx | bool
|
|
block:
|
|
- name: create client.crash keyring
|
|
ceph_key:
|
|
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
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|
|
|
|
- name: enforce container_binary on first monitor
|
|
import_role:
|
|
name: ceph-facts
|
|
tasks_from: container_binary.yml
|
|
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
|
delegate_facts: true
|
|
|
|
- name: set_fact container_exec_cmd
|
|
set_fact:
|
|
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] if not rolling_update | bool else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_facts']['hostname'] }}"
|
|
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
|
delegate_facts: true
|
|
when:
|
|
- containerized_deployment | bool
|
|
|
|
- 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] }}"
|
|
check_mode: False
|
|
changed_when: False
|
|
run_once: true
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|
|
|
|
- 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 }}"
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|
|
|
|
- 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_facts['hostname'] if containerized_deployment | bool else 'ceph-crash.service' }}"
|
|
state: started
|
|
enabled: yes
|
|
masked: no
|
|
daemon_reload: yes
|