2015-07-28 22:05:35 +08:00
|
|
|
---
|
2016-02-05 04:24:56 +08:00
|
|
|
# For openstack VMs modify the mount point below depending on if the Openstack
|
|
|
|
# VM deploy tool defaults to mounting ephemeral disks
|
|
|
|
- name: umount ceph disk (if on openstack)
|
2016-03-22 23:58:20 +08:00
|
|
|
mount:
|
2016-02-20 03:46:33 +08:00
|
|
|
name: /mnt
|
|
|
|
src: /dev/vdb
|
|
|
|
fstype: ext3
|
|
|
|
state: unmounted
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- ceph_docker_on_openstack
|
2016-03-22 23:58:20 +08:00
|
|
|
|
2017-10-20 21:15:38 +08:00
|
|
|
- name: test if the container image has the disk_list function
|
2017-11-02 23:17:38 +08:00
|
|
|
command: docker run --rm --entrypoint=stat {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} disk_list.sh
|
2017-10-20 21:15:38 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: disk_list
|
|
|
|
|
2017-02-08 05:00:53 +08:00
|
|
|
- name: generate ceph osd docker run script
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/ceph-osd-run.sh.j2"
|
2017-02-17 05:13:26 +08:00
|
|
|
dest: "{{ ceph_osd_docker_run_script_path }}/ceph-osd-run.sh"
|
2017-02-08 05:00:53 +08:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0744"
|
2018-06-28 15:54:24 +08:00
|
|
|
notify:
|
|
|
|
- restart ceph osds
|
2017-02-08 05:00:53 +08:00
|
|
|
|
2016-02-10 01:35:41 +08:00
|
|
|
- name: generate systemd unit file
|
2016-03-22 23:58:20 +08:00
|
|
|
become: true
|
2016-02-10 03:49:22 +08:00
|
|
|
template:
|
2016-06-02 16:52:23 +08:00
|
|
|
src: "{{ role_path }}/templates/ceph-osd.service.j2"
|
2016-06-28 19:48:46 +08:00
|
|
|
dest: /etc/systemd/system/ceph-osd@.service
|
2016-02-10 01:35:41 +08:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
2018-01-08 22:00:32 +08:00
|
|
|
notify:
|
|
|
|
- restart ceph osds
|
2016-02-10 01:35:41 +08:00
|
|
|
|
2018-07-17 00:09:33 +08:00
|
|
|
- name: collect osd ids
|
|
|
|
shell: >
|
|
|
|
docker run --rm
|
|
|
|
--privileged=true
|
|
|
|
-v /run/lvm/lvmetad.socket:/run/lvm/lvmetad.socket
|
|
|
|
-v /etc/ceph:/etc/ceph:z
|
|
|
|
-v /dev:/dev
|
|
|
|
--entrypoint=ceph-volume
|
|
|
|
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|
|
|
|
lvm list --format json | python -c 'import sys, json; print("\n".join(json.load(sys.stdin).keys()))'
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: ceph_osd_ids
|
|
|
|
when:
|
|
|
|
- containerized_deployment
|
|
|
|
- osd_scenario == 'lvm'
|
|
|
|
|
2016-02-10 01:35:41 +08:00
|
|
|
- name: systemd start osd container
|
2017-09-29 20:54:00 +08:00
|
|
|
systemd:
|
2018-07-17 00:09:33 +08:00
|
|
|
name: ceph-osd@{{ item | regex_replace('/dev/', '') if osd_scenario != 'lvm' else item }}
|
2016-02-10 01:35:41 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2017-09-29 20:54:00 +08:00
|
|
|
daemon_reload: yes
|
2018-07-17 00:09:33 +08:00
|
|
|
with_items: "{{ devices if osd_scenario != 'lvm' else ceph_osd_ids.stdout_lines }}"
|