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
|
2021-03-03 22:43:50 +08:00
|
|
|
- ansible_facts['service_mgr'] == 'systemd'
|
2017-07-05 21:47:48 +08:00
|
|
|
|
|
|
|
- name: add ceph-osd systemd service overrides
|
2022-01-13 23:57:50 +08:00
|
|
|
openstack.config_template.config_template:
|
2017-07-05 21:47:48 +08:00
|
|
|
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
|
2021-03-03 22:43:50 +08:00
|
|
|
- ansible_facts['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' }}"
|
2021-12-13 20:59:17 +08:00
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}', True) | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
|
2020-11-17 17:45:14 +08:00
|
|
|
|
2022-09-19 11:20:23 +08:00
|
|
|
- name: write /var/lib/ceph/osd/{{ cluster }}-{{ osd_id }}/run
|
|
|
|
template:
|
|
|
|
src: systemd-run.j2
|
|
|
|
dest: "/var/lib/ceph/osd/{{ cluster }}-{{ item }}/run"
|
|
|
|
mode: "0700"
|
|
|
|
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('{}', True) | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
|
|
|
|
when: containerized_deployment | bool
|
|
|
|
|
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
|
2021-12-13 20:59:17 +08:00
|
|
|
with_items: "{{ ((ceph_osd_ids.stdout | default('{}', True) | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
|