2017-07-26 05:48:13 +08:00
|
|
|
---
|
2019-07-24 16:10:18 +08:00
|
|
|
- name: umount ceph disk (if on openstack)
|
|
|
|
mount:
|
|
|
|
name: /mnt
|
|
|
|
src: /dev/vdb
|
|
|
|
fstype: ext3
|
|
|
|
state: unmounted
|
|
|
|
when:
|
|
|
|
- ceph_docker_on_openstack | bool
|
|
|
|
- containerized_deployment | bool
|
2018-11-07 18:45:29 +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
|
|
|
|
|
2018-11-07 18:45:29 +08:00
|
|
|
- name: set_fact docker_exec_start_osd
|
|
|
|
set_fact:
|
2020-01-11 04:35:58 +08:00
|
|
|
docker_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 else 'ceph-volume' }}"
|
2018-11-07 18:45:29 +08:00
|
|
|
|
|
|
|
- name: collect osd ids
|
2019-03-02 02:53:03 +08:00
|
|
|
command: "{{ docker_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
|
|
|
|
|
|
|
- name: systemd start osd
|
|
|
|
systemd:
|
2019-04-11 16:01:15 +08:00
|
|
|
name: ceph-osd@{{ item }}
|
2018-11-07 18:45:29 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2018-11-07 18:45:29 +08:00
|
|
|
daemon_reload: yes
|
2020-01-13 23:31:00 +08:00
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) + osd_ids_non_container.stdout_lines | default([]) }}"
|
2017-07-26 05:48:13 +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'
|