ceph-ansible/roles/ceph-osd/tasks/scenarios/collocated.yml

66 lines
2.2 KiB
YAML
Raw Normal View History

---
# use shell rather than docker module
# to ensure osd disk prepare finishes before
# starting the next task
- name: prepare ceph containerized osd disk collocated
shell: |
docker run --net=host \
--rm \
--pid=host \
--privileged=true \
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.1 | regex_replace('/dev/', '') }} \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /dev:/dev \
-v /etc/localtime:/etc/localtime:ro \
-e CLUSTER={{ cluster }} \
-e CEPH_DAEMON=OSD_CEPH_DISK_PREPARE \
-e OSD_DEVICE={{ item.1 }} \
{{ docker_env_args }} \
{{ ceph_osd_docker_prepare_env }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
with_together:
- "{{ parted_results.results | default([]) }}"
- "{{ devices }}"
when:
- not osd_auto_discovery
- containerized_deployment
- not item.0.get("skipped")
- item.0.get("rc", 0) != 0
- name: automatic prepare ceph containerized osd disk collocated
shell: |
docker run --net=host \
--rm \
--pid=host \
--privileged=true \
--name=ceph-osd-prepare-{{ ansible_hostname }}-{{ item.key }} \
-v /etc/ceph:/etc/ceph \
-v /var/lib/ceph/:/var/lib/ceph/ \
-v /dev:/dev \
-v /etc/localtime:/etc/localtime:ro \
-e CLUSTER={{ cluster }} \
-e CEPH_DAEMON=OSD_CEPH_DISK_PREPARE \
-e OSD_DEVICE=/dev/{{ item.key }} \
{{ docker_env_args }} \
{{ ceph_osd_docker_prepare_env }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
with_dict: "{{ ansible_devices }}"
when:
- osd_auto_discovery
- containerized_deployment
- ansible_devices is defined
- item.value.removable == "0"
- item.value.partitions|count == 0
- item.value.holders|count == 0
- name: manually prepare ceph "{{ osd_objectstore }}" non-containerized osd disk(s) with collocated osd data and journal
command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.1 }}"
with_together:
- "{{ parted_results.results | default([]) }}"
- "{{ devices }}"
when:
- not containerized_deployment
- not item.0.get("skipped")
- item.0.get("rc", 0) != 0