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
|
|
|
|
shell: |
|
2019-07-31 15:31:50 +08:00
|
|
|
set -o pipefail;
|
2018-11-29 21:59:25 +08:00
|
|
|
ls /var/lib/ceph/osd/ | sed 's/.*-//'
|
2019-07-31 15:31:50 +08:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2019-03-01 04:57:03 +08:00
|
|
|
changed_when: false
|
2018-11-29 21:59:25 +08:00
|
|
|
register: osd_ids_non_container
|
|
|
|
|
2020-10-02 17:00:29 +08:00
|
|
|
- name: set_fact container_exec_start_osd
|
2018-11-07 18:45:29 +08:00
|
|
|
set_fact:
|
2020-10-02 17:00:29 +08:00
|
|
|
container_exec_start_osd: "{{ container_binary + ' run --rm --net=host --privileged=true -v /var/run/udev/:/var/run/udev/:z -v /run/lvm/:/run/lvm/ -v /etc/ceph:/etc/ceph:z -v /dev:/dev --entrypoint=ceph-volume ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph-volume' }}"
|
2018-11-07 18:45:29 +08:00
|
|
|
|
|
|
|
- name: collect osd ids
|
2020-10-02 17:00:29 +08:00
|
|
|
command: "{{ container_exec_start_osd }} lvm list --format json"
|
2017-07-26 05:48:13 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
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
|
|
|
|
|
|
|
- name: systemd start osd
|
|
|
|
systemd:
|
|
|
|
name: ceph-osd@{{ item }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
masked: no
|
|
|
|
daemon_reload: yes
|
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines) | default([]) }}"
|