2017-07-26 05:48:13 +08:00
|
|
|
---
|
2018-11-29 21:59:25 +08:00
|
|
|
# this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
|
|
|
|
- name: get osd ids
|
2020-12-01 00:08:18 +08:00
|
|
|
shell: ls /var/lib/ceph/osd/ | sed 's/.*-//' # noqa 306
|
2019-07-31 15:31:50 +08:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2019-03-01 04:57:03 +08:00
|
|
|
changed_when: false
|
2020-12-01 00:08:18 +08:00
|
|
|
failed_when: false
|
2018-11-29 21:59:25 +08:00
|
|
|
register: osd_ids_non_container
|
|
|
|
|
2018-11-07 18:45:29 +08:00
|
|
|
- name: collect osd ids
|
2020-11-19 06:20:45 +08:00
|
|
|
ceph_volume:
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
action: list
|
|
|
|
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 }}"
|
2018-11-07 18:45:29 +08:00
|
|
|
register: ceph_osd_ids
|
|
|
|
|
2019-07-24 16:10:18 +08:00
|
|
|
- name: include_tasks systemd.yml
|
|
|
|
include_tasks: systemd.yml
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-11-07 18:45:29 +08:00
|
|
|
|
2017-07-05 21:47:48 +08:00
|
|
|
- name: ensure systemd service override directory exists
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: "/etc/systemd/system/ceph-osd@.service.d/"
|
|
|
|
when:
|
|
|
|
- ceph_osd_systemd_overrides is defined
|
|
|
|
- ansible_service_mgr == 'systemd'
|
|
|
|
|
|
|
|
- name: add ceph-osd systemd service overrides
|
|
|
|
config_template:
|
|
|
|
src: "ceph-osd.service.d-overrides.j2"
|
|
|
|
dest: "/etc/systemd/system/ceph-osd@.service.d/ceph-osd-systemd-overrides.conf"
|
|
|
|
config_overrides: "{{ ceph_osd_systemd_overrides | default({}) }}"
|
|
|
|
config_type: "ini"
|
|
|
|
when:
|
|
|
|
- ceph_osd_systemd_overrides is defined
|
2018-11-20 07:45:40 +08:00
|
|
|
- ansible_service_mgr == 'systemd'
|
2020-10-14 14:52:02 +08:00
|
|
|
|
2020-11-17 17:45:14 +08:00
|
|
|
- name: ensure "/var/lib/ceph/osd/{{ cluster }}-{{ item }}" is present
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: "/var/lib/ceph/osd/{{ cluster }}-{{ item }}"
|
|
|
|
mode: "{{ ceph_directories_mode }}"
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
|
|
|
|
|
2020-10-14 14:52:02 +08:00
|
|
|
- name: systemd start osd
|
|
|
|
systemd:
|
|
|
|
name: ceph-osd@{{ item }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
daemon_reload: yes
|
2020-10-19 17:39:06 +08:00
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
|