# partition.
- name: activate osd(s) when device is a disk
- command: ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
- with_together:
- - "{{ ispartition_results.results }}"
+ command: ceph-disk activate {{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
+ with_items:
- "{{ devices|unique }}"
changed_when: false
failed_when: false
register: activate_osd_disk
when:
- - not item.0.get("skipped")
- - item.0.get("rc", 0) != "0"
- not osd_auto_discovery
- name: activate osd(s) when device is a disk (dmcrypt)
- command: ceph-disk activate --dmcrypt {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
- with_together:
- - "{{ ispartition_results.results }}"
+ command: ceph-disk activate --dmcrypt {{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
+ with_items:
- "{{ devices|unique }}"
changed_when: false
failed_when: false
register: activate_osd_disk_dmcrypt
when:
- - not item.0.get("skipped")
- - item.0.get("rc", 0) != "0"
- not osd_auto_discovery
- dmcrypt
# NOTE (leseb): this task is for partitions because we don't explicitly use a partition.
- name: activate osd(s) when device is a partition
- command: "ceph-disk activate {{ item.1 }}"
- with_together:
- - "{{ ispartition_results.results }}"
+ command: "ceph-disk activate {{ item }}"
+ with_items:
- "{{ devices|unique }}"
changed_when: false
failed_when: false
when:
- - not item.0.get("skipped")
- - item.0.get("rc", 0) == "0"
- not osd_auto_discovery
# Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent)
static: False
-- name: check the journal device is partition
- shell: "readlink -f {{ item }} | egrep '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p)[0-9]{1,2}|fio[a-z]{1,2}[0-9]{1,2}$'"
- with_items: "{{ dedicated_devices }}"
- changed_when: false
- failed_when: false
- always_run: true
- register: journal_ispartition_results
-
- name: check the partition status of the journal devices
- shell: "parted --script {{ item.1 }} print > /dev/null 2>&1"
- with_together:
- - "{{ journal_ispartition_results.results }}"
+ command: "parted --script {{ item }} print"
+ with_items:
- "{{ dedicated_devices|unique }}"
changed_when: false
failed_when: false
always_run: true
register: journal_partition_status
when:
- - item.0.rc != 0
- osd_scenario == 'non-collocated'
- name: fix partitions gpt header or labels of the journal device(s)
- name: create gpt disk label of the journal device(s)
command: parted --script {{ item.1 }} mklabel gpt
with_together:
- - "{{ osd_partition_status_results.results }}"
+ - "{{ journal_partition_status.results }}"
- "{{ dedicated_devices|unique }}"
changed_when: false
when:
---
-- name: check if the device is a partition
- shell: "readlink -f {{ item }} | egrep '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p)[0-9]{1,2}|fio[a-z]{1,2}[0-9]{1,2}$'"
- with_items: "{{ devices }}"
- changed_when: false
- failed_when: false
- always_run: true
- register: ispartition_results
-
- name: check the partition status of the osd disks
- shell: "parted --script {{ item.1 }} print > /dev/null 2>&1"
- with_together:
- - "{{ ispartition_results.results }}"
+ command: "parted --script {{ item }} print"
+ with_items:
- "{{ devices }}"
changed_when: false
failed_when: false
always_run: true
register: osd_partition_status_results
- when: item.0.rc != 0
# NOTE: The following calls to sgdisk are retried because sgdisk is known to
# fully wipe a device the first time around. There is no need to halt execution
- containerized_deployment
- name: check if a partition named 'ceph' exists
- shell: "parted --script {{ item.1 }} print | egrep -sq '^ 1.*ceph'"
- with_together:
- - "{{ ispartition_results.results }}"
+ shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
+ with_items:
- "{{ devices }}"
changed_when: false
failed_when: false
always_run: true
register: parted_results
- when: item.0.rc != 0
docker run --net=host \
--pid=host \
--privileged=true \
- --name=ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item.2 | regex_replace('/', '') }} \
+ --name=ceph-osd-prepare-{{ ansible_hostname }}-dev{{ item.1 | regex_replace('/', '') }} \
-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.2 }} \
+ -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([]) }}"
- - "{{ ispartition_results.results | default([]) }}"
- "{{ devices }}"
when:
- not item.0.get("skipped")
- - not item.1.get("skipped")
- item.0.get("rc", 0) != 0
- - item.1.get("rc", 0) != 0
- not osd_auto_discovery
- containerized_deployment
- containerized_deployment
- 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.2 }}"
+ command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.1 }}"
with_together:
- "{{ parted_results.results | default([]) }}"
- - "{{ ispartition_results.results | default([]) }}"
- "{{ devices }}"
when:
- not item.0.get("skipped")
- - not item.1.get("skipped")
- item.0.get("rc", 0) != 0
- - item.1.get("rc", 0) != 0
- not containerized_deployment
- include: ../activate_osds.yml
{{ ceph_osd_docker_prepare_env }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
with_together:
- - "{{ parted_results.results }}"
+ - "{{ parted_results.results | default([]) }}"
- "{{ devices }}"
- "{{ dedicated_devices }}"
when:
- not item.0.get("skipped")
+ - item.0.get("rc", 0) != 0
- not osd_auto_discovery
- containerized_deployment
- osd_objectstore == 'filestore'
{{ ceph_osd_docker_prepare_env }} \
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
with_together:
- - "{{ parted_results.results }}"
+ - "{{ parted_results.results | default([]) }}"
- "{{ devices }}"
- "{{ dedicated_devices }}"
- "{{ bluestore_wal_devices }}"
when:
- not item.0.get("skipped")
+ - item.0.get("rc", 0) != 0
- not osd_auto_discovery
- containerized_deployment
- osd_objectstore == 'bluestore'
- name: prepare ceph "{{ osd_objectstore }}" non-containerized osd disk(s) non-collocated
- command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.2 }} {{ item.3 }}"
+ command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.1 }} {{ item.2 }}"
with_together:
- - "{{ parted_results.results }}"
- - "{{ ispartition_results.results }}"
+ - "{{ parted_results.results | default([]) }}"
- "{{ devices }}"
- "{{ dedicated_devices }}"
changed_when: false
when:
- - item.0.get("skipped") or item.0.get("rc", 0) != 0
- - not item.1.get("skipped")
- - item.1.get("rc", 0) != 0
+ - not item.0.get("skipped")
+ - item.0.get("rc", 0) != 0
- osd_objectstore == 'filestore'
- not containerized_deployment
- name: manually prepare ceph "{{ osd_objectstore }}" non-containerized osd disk(s) with a dedicated device for db and wal
command: "ceph-disk prepare {{ ceph_disk_cli_options }} --block.db {{ item.1 }} --block.wal {{ item.2 }} {{ item.3 }}"
with_together:
- - "{{ parted_results.results }}"
+ - "{{ parted_results.results | default([]) }}"
- "{{ dedicated_devices }}"
- "{{ bluestore_wal_devices }}"
- "{{ devices }}"
osd_objectstore: "bluestore"
devices:
- '/dev/sda'
-dedicated_devices:
- '/dev/sdb'
+dedicated_devices:
+ - '/dev/sdc'
+ - '/dev/sdc'
osd_scenario: non-collocated
os_tuning_params:
- { name: kernel.pid_max, value: 4194303 }
osd_objectstore: "bluestore"
devices:
- '/dev/sda'
-dedicated_devices:
- '/dev/sdb'
+dedicated_devices:
+ - '/dev/sdc'
+ - '/dev/sdc'
os_tuning_params:
- { name: kernel.pid_max, value: 4194303 }
- { name: fs.file-max, value: 26234859 }
osd_objectstore: bluestore
devices:
- /dev/sda
-dedicated_devices:
- /dev/sdb
+dedicated_devices:
+ - /dev/sdc
+ - /dev/sdc
ceph_osd_docker_prepare_env: -e OSD_FORCE_ZAP=1
ceph_osd_docker_run_script_path: /var/tmp
osd_objectstore: filestore
devices:
- '/dev/sda'
-dedicated_devices:
- '/dev/sdb'
+dedicated_devices:
+ - '/dev/sdc'
+ - '/dev/sdc'
osd_scenario: non-collocated
os_tuning_params:
- { name: kernel.pid_max, value: 4194303 }
osd_objectstore: filestore
devices:
- '/dev/sda'
-dedicated_devices:
- '/dev/sdb'
+dedicated_devices:
+ - '/dev/sdc'
+ - '/dev/sdc'
os_tuning_params:
- { name: kernel.pid_max, value: 4194303 }
- { name: fs.file-max, value: 26234859 }
osd_scenario: non-collocated
devices:
- /dev/sda
-dedicated_devices:
- /dev/sdb
+dedicated_devices:
+ - /dev/sdc
+ - /dev/sdc
ceph_osd_docker_prepare_env: -e OSD_JOURNAL_SIZE={{ journal_size }} -e OSD_FORCE_ZAP=1
ceph_osd_docker_run_script_path: /var/tmp
radosgw_interface: eth1
journal_size: 100
devices:
+ - '/dev/sda'
- '/dev/sdb'
dedicated_devices:
- '/dev/sdc'
+ - '/dev/sdc'
osd_scenario: non-collocated
os_tuning_params:
- { name: kernel.pid_max, value: 4194303 }