From d2b15067120281056d407ef1b428fa0f8564451f Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 10 Dec 2019 11:07:30 +0100 Subject: [PATCH] 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 (cherry picked from commit 4833b85e0428349f99c68a94f5f90867799ae224) --- .../filestore-to-bluestore.yml | 62 ++++--------------- 1 file changed, 13 insertions(+), 49 deletions(-) diff --git a/infrastructure-playbooks/filestore-to-bluestore.yml b/infrastructure-playbooks/filestore-to-bluestore.yml index 6e213f1c2..9eb998d53 100644 --- a/infrastructure-playbooks/filestore-to-bluestore.yml +++ b/infrastructure-playbooks/filestore-to-bluestore.yml @@ -30,16 +30,12 @@ register: osd_tree 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 - command: > - {{ 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 + command: "{{ container_run_cmd }} --cluster {{ cluster }} inventory --format json" register: ceph_volume_inventory - name: set_fact inventory @@ -63,15 +59,7 @@ with_items: "{{ ceph_disk_osds_devices | default([]) }}" - name: get simple scan data - command: > - {{ 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 + 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" register: simple_scan with_items: "{{ partlabel.results | default([]) }}" when: item.stdout == 'ceph data' @@ -104,9 +92,8 @@ failed_when: false changed_when: false when: - - (item.0.stdout | from_json).encrypted | default(False) - - - item.1.stdout == 'ceph data' + - (item.0.stdout | from_json).encrypted | default(False) - name: ensure dmcrypt for journal device is closed command: cryptsetup close "{{ (item.0.stdout | from_json).journal.uuid }}" @@ -116,34 +103,18 @@ failed_when: false changed_when: false when: - - (item.0.stdout | from_json).encrypted | default(False) - item.1.stdout == 'ceph data' + - (item.0.stdout | from_json).encrypted | default(False) - name: zap data devices - command: > - {{ 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 }} + command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}" with_together: - "{{ simple_scan.results }}" - "{{ partlabel.results }}" when: item.1.stdout == 'ceph data' - name: zap journal devices - command: > - {{ 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 }} + command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}" with_together: - "{{ simple_scan.results }}" - "{{ partlabel.results }}" @@ -152,15 +123,7 @@ - (item.0.stdout | from_json).journal.path is defined - name: get ceph-volume lvm list data - command: > - {{ 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 + command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm list --format json" register: ceph_volume_lvm_list - name: set_fact _lvm_list @@ -188,7 +151,7 @@ with_items: "{{ _lvm_list }}" changed_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 set_fact: @@ -239,6 +202,7 @@ name: ceph-handler - import_role: name: ceph-container-common + when: containerized_deployment | bool - import_role: name: ceph-osd vars: