filestore-to-bluestore: add non containerized support

This commit adds the non containerized context support to the
filestore-to-bluestore.yml infrastructure playbook.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1729267

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4833b85e04)
pull/4885/head
Guillaume Abrioux 2019-12-10 11:07:30 +01:00
parent 78799ecf55
commit d2b1506712
1 changed files with 13 additions and 49 deletions

View File

@ -30,16 +30,12 @@
register: osd_tree register: osd_tree
run_once: true run_once: true
- name: set_fact container_run_cmd
set_fact:
container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}"
- name: get ceph-volume lvm inventory data - name: get ceph-volume lvm inventory data
command: > command: "{{ container_run_cmd }} --cluster {{ cluster }} inventory --format json"
{{ container_binary }} run --rm --privileged=true
--ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-v /dev:/dev -v /etc/ceph:/ceph/ceph
-v /var/lib/ceph:/var/lib/ceph
-v /var/run:/var/run
--entrypoint=ceph-volume
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
inventory --format json
register: ceph_volume_inventory register: ceph_volume_inventory
- name: set_fact inventory - name: set_fact inventory
@ -63,15 +59,7 @@
with_items: "{{ ceph_disk_osds_devices | default([]) }}" with_items: "{{ ceph_disk_osds_devices | default([]) }}"
- name: get simple scan data - name: get simple scan data
command: > command: "{{ container_run_cmd }} --cluster {{ cluster }} simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout"
{{ container_binary }} run --rm --privileged=true
--ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-v /dev:/dev -v /etc/ceph:/etc/ceph
-v /var/lib/ceph:/var/lib/ceph
-v /var/run:/var/run
--entrypoint=ceph-volume
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout
register: simple_scan register: simple_scan
with_items: "{{ partlabel.results | default([]) }}" with_items: "{{ partlabel.results | default([]) }}"
when: item.stdout == 'ceph data' when: item.stdout == 'ceph data'
@ -104,9 +92,8 @@
failed_when: false failed_when: false
changed_when: false changed_when: false
when: when:
- (item.0.stdout | from_json).encrypted | default(False)
-
- item.1.stdout == 'ceph data' - item.1.stdout == 'ceph data'
- (item.0.stdout | from_json).encrypted | default(False)
- name: ensure dmcrypt for journal device is closed - name: ensure dmcrypt for journal device is closed
command: cryptsetup close "{{ (item.0.stdout | from_json).journal.uuid }}" command: cryptsetup close "{{ (item.0.stdout | from_json).journal.uuid }}"
@ -116,34 +103,18 @@
failed_when: false failed_when: false
changed_when: false changed_when: false
when: when:
- (item.0.stdout | from_json).encrypted | default(False)
- item.1.stdout == 'ceph data' - item.1.stdout == 'ceph data'
- (item.0.stdout | from_json).encrypted | default(False)
- name: zap data devices - name: zap data devices
command: > command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}"
{{ container_binary }} run --rm --privileged=true
--ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-v /dev:/dev -v /etc/ceph:/etc/ceph
-v /var/lib/ceph:/var/lib/ceph
-v /var/run:/var/run
--entrypoint=ceph-volume
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}
with_together: with_together:
- "{{ simple_scan.results }}" - "{{ simple_scan.results }}"
- "{{ partlabel.results }}" - "{{ partlabel.results }}"
when: item.1.stdout == 'ceph data' when: item.1.stdout == 'ceph data'
- name: zap journal devices - name: zap journal devices
command: > command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}"
{{ container_binary }} run --rm --privileged=true
--ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-v /dev:/dev -v /etc/ceph:/etc/ceph
-v /var/lib/ceph:/var/lib/ceph
-v /var/run:/var/run
--entrypoint=ceph-volume
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}
with_together: with_together:
- "{{ simple_scan.results }}" - "{{ simple_scan.results }}"
- "{{ partlabel.results }}" - "{{ partlabel.results }}"
@ -152,15 +123,7 @@
- (item.0.stdout | from_json).journal.path is defined - (item.0.stdout | from_json).journal.path is defined
- name: get ceph-volume lvm list data - name: get ceph-volume lvm list data
command: > command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm list --format json"
{{ container_binary }} run --rm --privileged=true
--ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
-v /dev:/dev -v /etc/ceph:/ceph/ceph
-v /var/lib/ceph:/var/lib/ceph
-v /var/run:/var/run
--entrypoint=ceph-volume
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
lvm list --format json
register: ceph_volume_lvm_list register: ceph_volume_lvm_list
- name: set_fact _lvm_list - name: set_fact _lvm_list
@ -188,7 +151,7 @@
with_items: "{{ _lvm_list }}" with_items: "{{ _lvm_list }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
when: item['tags']['ceph.encrypted'] | int == 1 when: item['tags'].get('ceph.encrypted', 0) | int == 1
- name: set_fact osd_fsid_list - name: set_fact osd_fsid_list
set_fact: set_fact:
@ -239,6 +202,7 @@
name: ceph-handler name: ceph-handler
- import_role: - import_role:
name: ceph-container-common name: ceph-container-common
when: containerized_deployment | bool
- import_role: - import_role:
name: ceph-osd name: ceph-osd
vars: vars: